BuddyDev

Search

[Resolved] Buddypress site wide activity as homepage for logged in users


  • Participant
    Level: Enlightened
    Posts: 72
    Tosin on #20814

    Hello,

    Please how can I make Buddypress site wide activity as homepage for logged in users. This Facebook like functionality will only work for buddypress sites with a static Homepage for visitors (logged out users)

    1. when user log into website, user is redirected to site wide activity page.
    2. when logged in user try to move to homepage, user is redirected to site wide activity page.
    3. when user logs out of your website, user is redirected to homepage of the website
    4. every time loggedin user clicks on homepage links or logo of your website, he will be redirected to site wide activity page.

    Thanks


  • Keymaster
    (BuddyDev Team)
    Posts: 10971
    Brajesh Singh on #20817

    Hi Tosin,
    Thank you for asking.

    For 2,4

    
    
    /**
     * For logged in user, Redirect to activity if trying to access home page
     */
    function buddydev_redirect_tot_activity_for_loggedin() {
    	if ( ! is_user_logged_in() ) {
    		return;
    	}
    	if ( is_front_page() ) {
    		bp_core_redirect( bp_get_activity_directory_permalink() );
    	}
    }
    
    add_action( 'bp_template_redirect', 'buddydev_redirect_tot_activity_for_loggedin' );
    

    1.- Depending on your setup, you may or may not need it. I am not putting any code for it as from previous posts by you, I am aware you have other redirects setup.

    4. Use any existing plugin for it. It is 4-5 line of code but I am trying to avoid causing conflict with your existing setup.

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 72
    Tosin on #20820

    Hello brajesh,

    Thank you very much your code worked perfectly, you are a life saver I’m really grateful for your help. I will also like to appreciate the good work you’re doing with buddypress. Your deep contribution has truly transformed buddypress from what it was 5 years ago.

    God bless you


  • Keymaster
    (BuddyDev Team)
    Posts: 10971
    Brajesh Singh on #20824

    Thank you Tosin.
    I sincerely appreciate your kind words and support for all these years 🙂

    Best regards
    Brajesh

The topic ‘ [Resolved] Buddypress site wide activity as homepage for logged in users’ is closed to new replies.

This topic is: resolved
Subscribe