BuddyDev

Search

Hide BuddyPress members directory from non logged users redirect to login page


  • Participant
    Level: Enlightened
    Posts: 104
    Tosin on #22340

    Hello,

    How can I redirect this code to the wordpress login page.

     /**
     * Hide Members Directory and single members page from non members(not logged in users)
     */
    function buddydev_hide_members_directory_for_non_members() {
        if ( bp_is_members_directory() || bp_is_user() ) {
            if (!is_user_logged_in() ) {
                 bp_core_redirect( bp_get_signup_page() );
            }
        }
    }
     
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_for_non_members' );  

    Thanks


  • Keymaster
    (BuddyDev Team)
    Posts: 11751
    Brajesh Singh on #22353

    Please change

    bp_get_signup_page()
    to

    
    wp_login_url()
    
    

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved
Subscribe