Changing user role in Profile Edit
-
I am using a clever script to allow users to select a user role on registration:
`add_action(‘user_register’, ‘register_role’);
function register_role($user_id, $password=”", $meta=array()) {
$userdata = array();
$userdata = $user_id;
$userdata = $_POST;//only allow if user role is my_role
if ($userdata == “my_role”){
wp_update_user($userdata);
}
}`
Source: http://www.jasarwebsolutions.com/2010/06/27/how-to-change-a-users-role-on-the-wordpress-registration-form/I am trying to adapt it to use on the BuddyPress Profile Edit form but cannot get it to work. I guess it needs the right add_action(). Any ideas what that would be?
You must be logged in to reply to this topic.