• Resolved rpatwall1206

    (@rpatwall1206)


    HELLO,

    Is thera a feature or a code snippet that will allow me to make the youzify custom login page the firt page that shows when people add my usrl to the browser, so no one can see the site content without being logging in or registering.

    I have tried redirects which only direct the user to the WP login-php and leads to the WP dashboard. Redirects don’t pay any attention to the “login” custom page for Youzy.

    Any help would be great, Thank you

    • This topic was modified 3 years, 7 months ago by rpatwall1206.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Youzify

    (@kainelabsteam)

    Hello @rpatwall1206,

    Thanks for using our plugin.

    Here’s The code snippet below, please add it to the file “bp-custom.php” in the path “wp-content/plugins”:

    <?php
    
    /**
     * Youzify - BuddyPress Redirect All Site The Login Page For Non-Logged-In Users.
     */
    function yzc_redirect_all_site_to_login_page() {
    
        if ( is_user_logged_in() ) {
            return;
        }
        
        if ( 'off' == get_option( 'youzify_activate_membership_system' ) ) {
            return true;
        }  
    
        if ( ! youzify_is_membership_page( 'login' ) && ! bp_is_register_page() && ! youzify_is_membership_page( 'lost-password' ) && ! bp_is_activation_page() ) {
            $login_page = youzify_membership_page_url( 'login' );
            wp_safe_redirect( $login_page );
            exit(); 
        }
    
    }
    
    add_action( 'template_redirect', 'yzc_redirect_all_site_to_login_page' );

    Ps: if you didn’t find the file “bp-custom.php”, just create a new one.?

    Please let me know if this worked fine for you ??

    You are welcome.

    Best Regards, KaineLabs Team.

    Thread Starter rpatwall1206

    (@rpatwall1206)

    Hello, Thank you so much that worked just great!
    Could you help me with one more thing.

    When the members log out they are redirected to the login page, which is great!.
    Is there any way for that page to show “logged-Out” instead of the error messages about the fields being empty?

    Thank you so much, for your speedy response and helpful support.

    • This reply was modified 3 years, 7 months ago by rpatwall1206.
    Plugin Support Youzify

    (@kainelabsteam)

    Hello @rpatwall1206,

    You are welcome, Happy that that snippet worked fine for you ??

    For the second issue I just checked on my localhost it’s working fine, it does not show that message, this might be a conflict with something.

    Please are you using any other membership plugin on the site also cache on the site? if yes please exclude membership pages ( login, register, lost password, activate ) from caching.

    Waiting for your reply.

    Best Regards, KaineLabs Team.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PRIVATE SITE USING YOUZY LOGIN PAGE’ is closed to new replies.