Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity default tab

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

  • Venutius
    Moderator

    @venutius

    This method suggested by danbp works:

    help with default activity stream tab


    Raval
    Participant

    @ravals

    Thanks @Venutius
    It works great


    Raval
    Participant

    @ravals

    @Venutius
    Unfortunately, there is a problem.
    The code changes the default tab in my profile and in my friend profiles
    but at my friends I lose the opportunity to enter into their other tab. all time forces this one default. Is there any way for the default tab to be enforced only on my profile?


    Venutius
    Moderator

    @venutius

    You could try:

    function bpex_set_member_default_nav() {
     
        if ( bp_displayed_user_id() == get_current_user_id() ) {
            bp_core_new_nav_default (
                array(
                    'parent_slug'       => buddypress()->activity->id,
    	        // other "activity" sub_nav slugs : personal favorites friends groups
                    'subnav_slug'       => 'mentions',
                    'screen_function'   => 'bp_activity_screen_mentions'
                )
            );
        }
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );

    Raval
    Participant

    @ravals

    @Venutius
    Thank you for your time and for this code. However, after adding it to bp-custom, I lose the opportunity to see personal activities in my profile. Reloads to the indicated new default tab.
    Thank you again for your help, however, if you know how to solve this problem, I am asking you for help


    Venutius
    Moderator

    @venutius

    Yes I see the problem, it’s pretty significant.

    The personal activity page has the URL site.com/activity

    The mentions page has the url site.com/activity/mentions

    The code redirects url requests for site.com/activity to site.com/activity/mentions, so there’s no possibility of visiting the original site.com/activity page.

    The odd thing is, reading through the code, the personal activity page also has a url of activity/just-me but none of the links point to this and when I manually enter mysite.com/activity/just me I get a weird result, I get a page load error and the url seems to be repeating the just-me part when the above code is loaded. This messes up what /i was hoping could be the solution: to reset the personal activity links to point to activity/just-me.

    I’ve spent quite a bit of time on this and I don’t think it’s possible to do this, I’ve tried several ways and I think it would probably be easier to overload the activity page template and make it display the information you want to see maybe?


    Raval
    Participant

    @ravals

    Can you show me what you mean? I will be grateful for that
    If there’s a way, I’d like to see it


    Venutius
    Moderator

    @venutius

    Can you look in Settings>>BuddyPress>>Options and let me know which BP Theme you are using?


    Venutius
    Moderator

    @venutius

    Hey, it looks like I gave up just a tad early. I think I’ve got it working now:

    function bpex_set_member_default_nav() {
     
        	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		return;
    	}
            
            if ( bp_displayed_user_id() == get_current_user_id() ) {
            
            bp_core_new_nav_default(
                array(
                    'parent_slug'       => buddypress()->activity->id,
    	        // other "activity" sub_nav slugs : personal favorites friends groups mentons
                    'subnav_slug'       => 'friends',
                    'screen_function'   => 'bp_activity_screen_friends'
                )
            );
        }
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );
    
    add_action( 'bp_setup_nav', 'bpex_just_me_tab', 50 );
    add_action( 'bp_setup_admin_bar', 'bpex_admin_bar_add', 50 );
    
    function bpex_just_me_tab() {
    	
    	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		return;
    	}
    	
    	global $bp;
    	$is_own_view = false;
    	$user_id = bp_displayed_user_id();
    	
    	if ( get_current_user_id() == $user_id ) $is_own_view = true;
    	
    
    	if ( $is_own_view ) {
    
    		bp_core_remove_subnav_item( 'activity', 'just_me');
    
    		bp_core_new_subnav_item( array(
    			'name'            => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ),
    			'slug'            => 'just-me',
    			'parent_url'      => bp_core_get_user_domain( $user_id ) . 'activity/',
    			'parent_slug'     => 'activity',
    			'screen_function' => 'bp_activity_screen_my_activity',
    			'position'        => 10
    		) );
    	}
    
    }
    
    function bpex_admin_bar_add() {
    	
    	global $wp_admin_bar, $bp;
    
    	if ( ! bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) {
    		return false;
    	}
    
    	$user_id = get_current_user_id();
    	
    	if ( ! $user_id || $user_id == 0 || ! is_numeric( $user_id ) ) {
    		return;
    	}
    	
    	// Personal.
    	$wp_admin_bar->remove_menu( 'my-account-activity-personal', 'my-account-activity' );
    
    	$wp_admin_bar->add_menu( array(
    		'parent'   => 'my-account-activity',
    		'id'       => 'my-account-activity-personal',
    		'title'    => 'Personal',
    		'href'     => bp_core_get_user_domain( $user_id ) . 'activity/180/',
    		'position' => 10
    	) );
    }
    

    Give it a try


    Raval
    Participant

    @ravals

    @Venutius unfortunately, nothing has changed.
    Personal activities are still not available. I use Template Pack BuddyPress Legacy.
    but I’m not attached to this. If it is necessary to change it, I will do it


    Venutius
    Moderator

    @venutius

    Ah there was a typo in the cde, I’ve corrected it, could you retry?


    Raval
    Participant

    @ravals

    @Venutius now it works great. I am very grateful for what you have done for me. Thank you very much for your time;)


    Venutius
    Moderator

    @venutius

    That’s great! It took me a while to figure it out and it would have definitely been a downer if it didn’t work.

    I also worked out how to combine all of the activity types onto one page here https://buddypress.org/support/topic/how-to-combine-activity-tabs-to-one/ it may also be of interest.


    Raval
    Participant

    @ravals

    It looks really interesting. I will try to add this to my site because it gives interesting possibilities.
    Thank you very much for all:)


    Venutius
    Moderator

    @venutius

    The combined activity feed should give an activity feed similar to Facebook without the filtering algorithm. I’m thinking of putting it into a plugin for easier deployment.


    Venutius
    Moderator

    @venutius

    I’ve updated the code, there was an error causing the main Activity page to go missing. fixed now.


    Raval
    Participant

    @ravals

    Hi @Venutius
    I need your help. Until now, everything was ok but now when I use your code it shows me that the page was not found. What happened?


    Orance Willi
    Participant

    @orance

    happend with me too following the issue for this site.

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