Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to make section of profile private?

@henrywright

Moderator

Hi @screampuff

You can make that link private by doing something like this:

function screampuff_hide_achi() {
    // Bail if the current user is the displayed user.
    if ( bp_loggedin_user_id() == bp_displayed_user_id() )
        return;

    // Bail if the current user is an admin.
    if ( current_user_can( 'manage_options' ) )
        return;

    // Bail if not the achievements page.
    if ( bp_current_action() != 'achievements' )
        return;

    // Redirect.
    wp_redirect( home_url() );
    exit;
}
add_action( 'template_redirect', 'screampuff_hide_achi' );

Please note I haven’t tested. Also, I’m assuming the current action is ‘achievements’. It may be something else in which case the function will need a minor tweak.

Skip to toolbar