[wp-hackers] Changing user role, bug ?
Lox
lox.dev at knc.nc
Wed Aug 11 05:27:05 UTC 2010
Hello,
In a custom registration form I made, the email adress of subscribers needs
to be validated. So when one subscribes, it is added to a custom role called
'inactive'. Right after subscribing, the subscriber receives an email
containing an activation link (with a key and the user_login in the query
string)
After checking the key and the user_login, I need to change the user role to
'subscriber', so I do:
<?php
$user = new WP_User($user->ID);
$user->set_role( 'subscriber ');
?>
After one activates and looking to my users in wp-admin, this user has no
role! The 'inactive' role has been removed, but it seems the 'subscriber'
role hasn't been added.
- User object before set_role() :http://paste2.org/p/946080
- User object after set_role() : http://paste2.org/p/946081
*Note:* I did also tried $user->remove_role('inactive') and then
$user->add_role('subscriober') with the same problem: 'inactive' gets
removed but 'subscriber' is not added.
Regards.
--
Lox
lox.dev at knc.nc
More information about the wp-hackers
mailing list