Setting New Role Upon Login with iMember360 Plugin
-
So iMember360 has a hook that I am trying to attach with to bbPress that I am struggling to do.
I want to set it up so that when a user logins, and they contain certain tags (detected by iMember360), to change bbPress roles.
Below is the hook I am trying to use.
function my_i4w_authenticated_lremote_ogin($wp_user, $arrINFU) { // // $wp_user is the user object (same as the standard $current_user) // // $contact is an array with all contact record fields. // add your code to perform any desired action, such as sending an email notification // or updating contact record to reflect the login that just took place $your_code_goes_here = true; } add_action('i4w_authenticated_remote_login', 'my_i4w_authenticated_remote_login',10,2);
Here is what I tried to do:
function i4w_authenticated_remote_login_action($user, $contact) { global $SESSION; IF ($arrTAGS = explode(',', $SESSION['i4wuser']['Groups'])) : IF (in_array(38181, $arrTAGS) || in_array(38185, $arrTAGS) || in_array(38193, $arrTAGS)) : $bbp = bbpress(); $bbp->current_user = new WP_User($user->ID); $new_role_forum_role=”bbp_participant”; bbp_set_user_role( $bbp->current_user, $new_role_forum_role ); ELSEIF (in_array(38177, $arrTAGS) || in_array(38195, $arrTAGS) || in_array(38183, $arrTAGS) || in_array(38187, $arrTAGS) || in_array(38189, $arrTAGS)) : $bbp = bbpress(); $bbp->current_user = new WP_User($user->ID); $new_role_forum_role=”bbp_spectator”; bbp_set_user_role( $bbp->current_user, $new_role_forum_role ); ENDIF; ENDIF; } add_action('i4w_authenticated_remote_login', 'i4w_authenticated_remote_login_action', 10, 2);
However, nothing happens. I am not sure what I am missing here, but I suspect it is my lack of understanding with bbPress that is the issue.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.