Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide admin bar to subscriber role?


  • annie_sp04
    Participant

    @annie_sp04

    Hello!

    Is there a way to hide the admin from the users with subscriber role, but keep ir working for all other roles? On our site subscribers only have access to create a very simple profile, so i’d like to hide the admin bar for them since it only shows one link in it.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

  • Paul Wong-Gibbs
    Keymaster

    @djpaul

    Try putting something like this in /plugins/bp-custom.php:

    <?php
    if ( is_user_logged_in() ) {
    $user_roles = wp_get_current_user();
    $user_roles = $user_roles->roles;

    if ( empty( $user_roles ) || in_array( 'subscriber', $user_roles ) )
    define( 'BP_DISABLE_ADMIN_BAR', true );
    }
    ?>


    annie_sp04
    Participant

    @annie_sp04

    Thanks!

    I tried this and it gives me this error:

    Fatal error: Call to undefined function is_user_logged_in() in /plugins/bp-custom.php on line 2

    Any other suggestions?


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    is_user_logged_in() is present in both WP and WPMU. Odd. What versions of WordPress/WordPress MU are you using?


    annie_sp04
    Participant

    @annie_sp04

    I’m using WPMU 2.9.2 and the latest version of Buddypress. I guess i’ll try using it in a fresh install, maybe someone on our staff edited something they shouldn’t and it’s causing this error…

    Thanks :)


    annie_sp04
    Participant

    @annie_sp04

    Same error on fresh install… Maybe i should just leave it there? or create a different bar that will load only for authors?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide admin bar to subscriber role?’ is closed to new replies.
Skip to toolbar