Get 15% off on all our plugins, themes and memberships till 4th December. Use coupon: BLACKFRIDAY2021.

BuddyDev

Search

Homepage redirects to profile idea

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2342

    After logging, your plugin redirects people to their profile. Is there a way to redirect users if they are logged in to their profile every time they go to the homepage. This is kind of similar to Facebook.

  • Participant
    Level: Enlightened
    Posts: 69
    Christopher Niedzwiecki on #2344

    Figured out a way to work with it. Still up for solving if you’re interested 😛

  • Keymaster
    (BuddyDev Team)
    Posts: 19833
    Brajesh Singh on #2347

    Hi Christopher,
    good to know that you have figured it out 🙂
    Here is some code that will do the same

    
    
    add_action( 'template_redirect', 'buddydev_rediretc_to_profile' );
    function buddydev_rediretc_to_profile() {
    	
    	if ( is_user_logged_in() && is_front_page() ) {
    		wp_safe_redirect( bp_loggedin_user_domain() );
    		exit( 0 );
    	}
    }
    
    

    Hope that helps.

You must be logged in to reply to this topic.

This topic is: not resolved