Buddypress – when user activates account,user role changes to default
-
I am working with buddypress, I have a two user roles, 1-student 2-faculty and i have set default user role as subscriber. when user registers and activates account by clicking on link sent through mail.User role changes to default(subscriber).
Any idea what is the issue? Below is the code assigning role to user on sign up.
add_action('bp_core_signup_user', 'ad_user_signup_usermeta', 10, 5); function ad_user_signup_usermeta($user_id, $user_login, $user_password, $user_email, $usermeta) { if(isset($_POST['signup_membership']) && !empty($_POST['signup_membership'])) update_user_meta($user_id, 'membership', $_POST['signup_membership']); $userdata = array(); $userdata['ID'] = $user_id; if(!empty($_POST['signup_usertype'])) { if($_POST['signup_usertype'] == 'student') { $userdata['role'] = 'student'; } if($_POST['signup_usertype'] == 'instructor') { $userdata['role'] = 'instructor'; } } if ($userdata['role']){ wp_update_user($userdata); } }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Buddypress – when user activates account,user role changes to default’ is closed to new replies.