Skip to:
Content
Pages
Categories
Search
Top
Bottom

Deny access to admins profile (Update)


  • Kristian Yngve
    Participant

    @kristianngve

    Just over 3 years ago, the moderator, Danbp, had the once working code that went straight into your bp-custom.php file:

    // deny access to admins profile. User is redirected to the homepage
    function bpfr_hide_admins_profile() {
    global $bp;
    if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    wp_redirect( home_url() );
    exit;
    endif;
    }
    add_action( ‘wp’, ‘bpfr_hide_admins_profile’, 1 );

    **However, this no longer works with all those updates to the plugin.

    Anyone have an idea on what would be the up to date code that would work to actually deny all non-admin users access to admins profile?

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

  • shanebp
    Moderator

    @shanebp

    Please do not double post. Your other post on this topic has been deleted.

    Please use the code button when sharing code.

    Instead of: bp_is_profile
    Try: bp_is_user()


    Kristian Yngve
    Participant

    @kristianngve

    Oh sorry, I had copied it as is by the other moderator from a very old post. Thank you for cleaning that up for me, this should be the only one as a How to & Troubleshooting category.

    So, I did the changes and it didn’t work. I also tried changing the last part: hide_admins_profile’, 1 ); to hide_admins_user’, 1 ); but didn’t work sadly… resorted back to profile for that part.

    Any other suggestions that may work? I had also cleared the cache after any changes.


    Kristian Yngve
    Participant

    @kristianngve

    Anyone? 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar