Created
June 15, 2011 19:36
-
-
Save sbrajesh/1027903 to your computer and use it in GitHub Desktop.
It will make the community activity sub tab as default activity tab on profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment