Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] Hiding Members Page to everybody (visitor and also members)

@danbp

Participant

The function is working correctly on my install.

Perhaps you have an issue with quotes, ie after copy/pasting the snippet from a topic where the code whas inserted without using the code button.
Which software do you use to publish bp-custom ?

Copy/paste following and give a try:

function buddydev_hide_members_directory_from_all_except_admin() {

if ( bp_is_members_directory() && ! is_super_admin() ) {
//should we add a message too?
//bp_core_add_message( 'Private page.', 'error' );
bp_core_redirect( site_url('/') );
}
}
add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
Skip to toolbar