BuddyDev

Search

[Resolved] Community Activity on Profile

  • Participant
    Level: Initiated
    Posts: 3
    joym on #3727

    Hi Brajesh, I’m using this free plugin from BuddyDev(https://buddydev.com/buddypress/show-buddypress-communitysitewide-activity-on-user-profile/) and I am trying to have the “Activity” profile tab as the default. I found this code in the comments of this plugin but it doesn’t seem to be working. Can you please help?

    Code:

        //fix the nav default
        function bpcom_fix_nav(){
        global $bp;
        if(!bp_is_my_profile())
        return;
        if ( $bp->current_component == BP_ACTIVITY_SLUG && $bp->current_action==”just-me” ) {
    
        $action=bpcom_get_current_actual_action();
    
        if($action==BP_ACTIVITY_SLUG||$action== bp_get_loggedin_user_username()){
    
        //unset the default settings
        remove_action( ‘wp’, ‘bp_activity_screen_my_activity’, 3 );
        add_action( ‘wp’, ‘bp_community_activity_screen’, 3 );
        $bp->current_action = BPCOM_ACTIVITY_SLUG;
    
        }
        }
    
        }
        add_action(“init”,”bpcom_fix_nav”);
    
        function bpcom_get_current_actual_action(){
        $request_uri=$_SERVER[‘REQUEST_URI’];
        $uri_components= explode(“/”, $request_uri);
        if(empty($uri_components))
        return false;//just to prevent infinite loop
    
        while(!($current_action= array_pop($uri_components)))
        ;
        return $current_action;//first non empty string
    
        }
    
    
  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #3728

    Hi Joy,
    I am sorry, I could not reply to yopur PM earlier.

    Please do not use the above code.

    Do you want to set the “All Activity” as default page when activity is clicked? If yes, Please put the following code in bp-custom.php

    
    function buddydev_set_default_nav() {
    	bp_core_new_nav_default (
    		array(
    			'parent_slug'       => buddypress()->activity->id,
    			'subnav_slug'       => 'all-activity',
    			'screen_function'   => 'bp_community_activity_screen'
    		)
    	);
    }
    add_action( 'bp_setup_nav', 'buddydev_set_default_nav', 20 );
    
    

    That will do it. Please do let me know if it works or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    joym on #3759

    Thank you so much, it works perfectly! I appreciate it!

  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #3780

    Thank you Joy.

The topic ‘ [Resolved] Community Activity on Profile’ is closed to new replies.

This topic is: resolved