• Hi there,

    I want to do a function only, if a user is logged in and is set to a specific group (in my case subscriber).

    How can I archive that?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • function is_subscriber() {
        global $current_user;
        get_currentuserinfo();
        if( is_user_logged_in() ) {
            if ( user_can( $current_user, "subscriber" ) ){
                return true;
            } else {
                return false;
            }
        }
    }

    I haven’t tested this but this should get you started

    Thread Starter Zoker

    (@zoker)

    Thank you ??

    The problem is, that this effects every user with at least subscriber role.

    So also administrator and so on are affected

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if_group_is('subscriber')’ is closed to new replies.