Skip to:
Content
Pages
Categories
Search
Top
Bottom

Best way to remove or redirect away from sitewide /activity to profile activity?


  • Kir 2012
    Participant

    @kir-2012

    Hi, I’d like to remove the main sitewide activity page, I’d just like users to see their own stuff in the profile area with their profile cover header etc.

    Is there any reason not to redirect a user who hits my-site.com/activity to my-site.com/their-profile/activity?

    If that’s cool to do, what’s the best way to do this?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)

  • Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    Before deciding to redirect from sitewide activity to user’s own activity you should know the difference between them and then decide.

    – On the sitewide page a user can see activity from whole site(including his won/friends/his groups and any non related member of the site)

    – On profile, a user can see his/her won activity as well as friends/groups etc but activities of group they are not member of or activity of users they are not friends with, won’t be visible,

    If you still want to redirect from sitewide activity to user’s own activity, You may use the following code.

    
    
    /**
     * Redirect logged in user's from sitewide activity page to profile activity.
     */
    function buddydev_redirect_sitewide_activity_to_profile_activity() {
    
    	if ( is_user_logged_in() && bp_is_activity_directory() ) {
    		bp_core_redirect( bp_loggedin_user_domain() . bp_get_activity_slug() );
    	}
    }
    
    add_action( 'bp_template_redirect', 'buddydev_redirect_sitewide_activity_to_profile_activity' );
    

    PS:- you can put the code in your theme’s functions.php or in the wp-content/plugins/bp-custom.php

    Best Regards
    Brajesh


    Kir 2012
    Participant

    @kir-2012

    Thanks for this Brajesh – hmm yes I did consider keeping it up but I don’t like that there’s no profile header on it, is there a way to add the logged in user’s cover image header and profile nav to the sitewide activity page?

    I think I read once that the code that delivers the profile cover image / avatar / navs is dependent upon being situated in the member component or something similar, so it wasn’t just a case of me changing displayed user to logged in user etc, and so would be tricky to relocate, is that right?

    It would be great to know if it was poss to add the cover image header for the logged in user to the top of the sitewide activity page, any help or pointers much appreciated 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar