• CreativeWP

    (@creativewp)


    Hello,

    I am working on a website that needs to have a different front page after login. There are different things that need to happen in the second front page once you login. So even if you click on the link home, it will take you to the second login only homepage.

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    (@esmi)

    You should be able to do this via your theme. What theme are you using? Where did you download it from?

    Thread Starter CreativeWP

    (@creativewp)

    Themeforest. https://terso.themeva.com/

    I am looking for a php code.

    dsg257

    (@dsg257)

    you could try theme-my-login you can redirect them to any page you wish

    Thread Starter CreativeWP

    (@creativewp)

    I am thinking to use Peter’s Login Redirect.

    Thread Starter CreativeWP

    (@creativewp)

    I am already using theme-my-login, but that is only to redirect you after login. I want to have a front page for people who have not logged in, and another from page for those who login.

    I thought Peter’s login would do it, but not. hmmm

    That means, that my website is

    https://mywebsite.com for all users.

    https://mywebsite.com/logedin for those who login. EVEN if I click on the home page, to get redirected to that for registered users. I could hide the fact that is a second page (by name), but the second page has features that the first one did not.

    Thanks,

    This function will help you

    //if user is not logged in
    if(!is_user_logged_in() ) {
    wp_redirect( ‘page1’, 302 );
    }else{
    wp_redirect( ‘page2’, 302 );
    }

    Thread Starter CreativeWP

    (@creativewp)

    Thanks, I solved like this:

    [ Moderator note: Code block fixed. Don’t use blockquote it breaks the code formatting. ]

    <?php
    
    /**
    * Plugin Name: Logged in home redirect
    * Plugin URI: https://premium.wpmudev.org/forums/topic/redirect-homepage-to-another-for-logged-in-users
    * Description: Redirect logged in user's home page
    * Version: 1.0
    * Author: Your Name Here!
    * Author URI: https://premium.wpmudev.org/forums
    * License: GPL2
    */
    
    function logged_in_home_redirect() {
        if( is_user_logged_in() && is_front_page() ) {
            wp_redirect( 'https://www.redminka.com/publicaciones' );
            exit();
        }
    }
    add_action( 'template_redirect', 'logged_in_home_redirect' );
    
    ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Different frontpage after login’ is closed to new replies.