• Resolved Rhand

    (@rhand)


    I am using “Peter’s Login Redirect” to redirect users who log in to a landing page. I make landing pages per user group using WordPress Page Templates. Each landing page will have its own title and widgets. The problem is that this nice redirect plugin can redirect by user, redirect by role or by level. So not by Role Scoper’s user group. Does Role Scoper offer this functionality?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Rhand

    (@rhand)

    Perhaps I should just use conditional tags for the title and widgets, showing the proper title and widgets when need be. KevinB did give some code earlier:

    // substitute actual group ID here (id argument in edit links on User > Role Groups)
    $group_id_in_question = 12; 
    
    global $current_user;
    if ( isset( $current_user->groups[ $group_id_in_question ] ) ) {
       // do stuff
    }

    Just need to see where I can get the group ID and find a nice integration to show different blog titles and widgets per user group.

    Thread Starter Rhand

    (@rhand)

    Went into PMA and found user group nine for an added user group @ wp_user2group_rs . So that is a group I can use in my widget logic conditional tag for certain widgets:

    // substitute actual group ID here (id argument in edit links on User > Role Groups)
    $group_id_in_question = 9; 
    
    global $current_user;
    if ( isset( $current_user->groups[ $group_id_in_question ] ) ) {
       // show or hide widget depending on widget
    }

    Working on the function now..

    Thread Starter Rhand

    (@rhand)

    $group_id_in_question = 9;   global $current_user; if ( isset( $current_user->groups[ $group_id_in_question ] ) ) { display;}

    Does not seem to work

    Thread Starter Rhand

    (@rhand)

    I tried

    $group_id_in_question = 9;
    $current_user = wp_get_current_user();
    global $current_user;
    if ( isset( $current_user->groups[ $group_id_in_question ] ) );

    in as a conditional in a widget logic widget. It does not show up at all..

    Thread Starter Rhand

    (@rhand)

    Thought I perhaps needed the user ID and then check if user ID is part of group nine:

    $group_id_in_question = 9;
    $current_user = wp_get_current_user();
    global $current_user;
    $user_id = $current_user->ID;
    if ( $user_id->groups[ $group_id_in_question ] );

    Not luck yet..

    Thread Starter Rhand

    (@rhand)

    <?php
    $group_id_in_question = 9;
    $current_user = wp_get_current_user();
    global $current_user;
    $user_id = $current_user->ID;
    if ( $user_id->groups[ $group_id_in_question ] ) echo "whatever";
    else
    echo "Sue me!";
    ?>

    Echoes “Sue me!” so I guess I made a mistake somewhere…

    widget logic code needs to return TRUE or FALSE so change it to something like:

    $current_user = wp_get_current_user(); return isset( $current_user->groups[ 9 ] );

    (note final semi-colon is essential)

    Thread Starter Rhand

    (@rhand)

    Thanks a lot for this!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Redirect users in user group to landing page x’ is closed to new replies.