WordPress.org

Support

Support » Plugins and Hacks » Groups » [Resolved] [Plugin: Groups] Is there a PHP function like get_user_group()?

[Resolved] [Plugin: Groups] Is there a PHP function like get_user_group()?

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

    @itthinx

    Thanks, @itthinx.

    I’m not very good with PHP objects, so went for the ‘long but simple’ route.

    $userid = $current_user->ID;
    
    $user = new Groups_User( $userid );
    $groups = $user->__get( 'groups' );
    
    $gr1 = (get_object_vars($groups[1]));
    $gr2 = (get_object_vars($gr1[group]));
    
    if ($gr2 != "Team members" && $gr2 != "Associates")
    {
    	wp_die('This function is only for Team members and Associates.  Would you like to <a href="'.wp_logout_url( $redirect ).'">log in as another user</a>?');
    }

    Thanks again,

    R

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Groups] Is there a PHP function like get_user_group()?’ is closed to new replies.
Skip to toolbar