Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding/Redirecting Members Directory Code Not Working


  • otty-dev
    Participant

    @ottiya

    I tried to implement the following code:

    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' );

    in plugins> bp-custom.php. Just in case, I also tried to implement it by creating a new plugin folder > bp-custom.php in the child theme, but the member directory page is still visible to non-admin/non-logged in users.

  • You must be logged in to reply to this topic.
Skip to toolbar