I have a site with about 30 members, but I just added a new mandatory field on the registration. I want the old members to be forced to fill this in as well. What would be the best way to do this?
1 Answer
Choose one:
- Use the rules module to test whether the user has authenticated and the field value of the current user is empty. Redirect to
user/[uid]/edit
if this is the case. Do the same test in a module during your implementation of hook_init(). Call
drupal_goto('user/[uid]/edit')
to redirect to the user edit page.
Do the same test in a module during your implementation of hook_init(). Call
menu_set_active_item('user/[uid]/edit');
to show the user edit page.
Replace [uid]
by the user id of the currently logged in user.
In cases 1 and 2, you also have to make sure that you do not redirect from 'user/[uid]/edit'
back to 'user/[uid]/edit'
. This would create an infinite loop of redirections, because the POST data gets lost when redirecting.
Documentation:
-
I couldn't make a rule that would take them to the edit page, but I made a rule that takes them to their account and gives a message to "edit account". Good enough for me. Everytime I tried to make it go to "user/[account:id]/edit" it would give me an access denied error. Weird.– EGHDKCommented Sep 23, 2012 at 1:58