Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Kevin Behrens

    (@kevinb)

    That will require some custom code which you can hook to the login_redirect filter.

    Your check can look something like this:

    global $current_user;
    if ( isset( $current_user->groups['pp_group'][$my_member_group_id] ) ) {
       // redirect for Members
    }  // etc. for Premium
    Thread Starter Tom Carney

    (@tecdoc)

    Tried your code but didn’t redirect properly to the specific page:

    Here is the code that I tried, was using the function pp_get_groups_for_user from api_pp.php:

    function my_login_redirect( $redirect_to ) {
      //is there a user to check?
      global $current_user;
      $groups= pp_get_groups_for_user($current_user->ID, 'pp_group');
      // var_dump($groups);
       // Beaumont Member redirect to the bcm member page
        if ( in_array( '12', $groups ) ) {
            //redirect them to the default place
              return (get_home_url().'/bcm-member-strategy');
            }  
    
         elseif
        // Fidelity Member redirect to the fidelity member page
        ( in_array( '13', $groups ) ) {
          // redirect them to the default place
          return (get_home_url().'/bcm-fidelity-strategies');
        }
     else {
      return $redirect_to;
     }
    
    }
    add_filter( 'login_redirect', 'my_login_redirect');

    if you check if I am using the function properly or which function I should use to get the redirection working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirecting users from groups to the group protected page’ is closed to new replies.