User set_role setting role to 'None'
-
Hello Hack Community!
So I have a very odd scenario, but first let it be known I’m using the plugin Role Manager (found here). I realize this could entirely be the issue but I’ve tried deactivating it and running my code and it still does not work.
Full Scenario: I’ve created a function (in functions.php) to fire after a customer buys a membership product. I need their role elevated after payment is received.
So my problem is that when I am using the set_role function to change a users role to a custom one I’ve created, it doesn’t completely work. It actually sets the users role to ‘None’. Under the edit page of that user it further defines this as ‘No role for this site’. Even more odd it just happens to list the user under the custom role I created! Further testing proved that if I even use set_role to change the user role to ‘Administrator’, it once again sets the user role to ‘None’ but LISTS THE USER UNDER ADMINISTRATORS. Very peculiar. This means they are listed properly but have none of the capabilities of the role.
Here is my usage of set_role in my function:
global $current_user;
get_currentuserinfo();
$wp_user_object = new WP_User($current_user->ID); //not used
$current_user->set_role(SisterhoodMember);I was using a WP_User object before but it was the same as using $current_user so I went with the more direct route. Can anyone help me out with this?? Is it the plugin? I really would like to keep it, my client has been using it for quite a while.
If the full function is necessary I will post it, I’d rather not but I will if necessary. Thank you to anyone who can help me!!
- The topic ‘User set_role setting role to 'None'’ is closed to new replies.