Thursday, June 16, 2022
HomeWordPress Developmentphp - Learn how to Redirect Buddypress Directories To Login Web page...

php – Learn how to Redirect Buddypress Directories To Login Web page For Non Logged in Customers


Learn how to Redirect Buddypress Directories To Login Web page For Non Logged in Customers?
I am additionally utilizing the Yuzify plugin. It provides a code for it, but it surely’s not engaged on multisite. Can anybody modify this code or present me with a brand new code for it?

/**
* Redirect Buddypress Directories To Login Web page For Non Logged in Customers.
*/
perform yzc_redirect_bp_directories_to_login_page() {

    if ( ! is_user_logged_in() && ( bp_is_groups_directory() || bp_is_members_directory() ) ) {
        
        // Get Buddypress Pages;
        $bp_pages = get_option( 'bp-pages' );
        
        // Get Redirection Url
        $redirect_url = youzify_get_login_page_url();
        
        wp_redirect( $redirect_url );
        exit();
    }
}

add_action( 'template_redirect', 'yzc_redirect_bp_directories_to_login_page' );

Thanks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments