Changeset 5301 for trunk/bp-members/bp-members-template.php
- Timestamp:
- 11/08/2011 01:14:31 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-template.php
r5271 r5301 282 282 283 283 // User filtering 284 if ( !empty( $bp->displayed_user->id) )285 $user_id = $bp->displayed_user->id;284 if ( bp_displayed_user_id() ) 285 $user_id = bp_displayed_user_id(); 286 286 287 287 // type: active ( default ) | random | newest | popular | online | alphabetical … … 610 610 if ( !empty( $members_template->member->id ) ) 611 611 $user_id = $members_template->member->id; 612 elseif ( !empty( $bp->displayed_user->id) )613 $user_id = $bp->displayed_user->id;612 elseif ( bp_displayed_user_id() ) 613 $user_id = bp_displayed_user_id(); 614 614 615 615 $defaults = array( … … 716 716 then check to see if the two users are friends. if they are, add a highlight CSS class 717 717 to the friends nav item if it exists. */ 718 if ( !bp_is_my_profile() && $bp->displayed_user->id) {718 if ( !bp_is_my_profile() && bp_displayed_user_id() ) { 719 719 $selected = ''; 720 720 721 721 if ( bp_is_active( 'friends' ) ) { 722 722 if ( $nav_item['css_id'] == $bp->friends->id ) { 723 if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id) )723 if ( friends_check_friendship( $bp->loggedin_user->id, bp_displayed_user_id() ) ) 724 724 $selected = ' class="current selected"'; 725 725 } … … 804 804 extract( $r, EXTR_SKIP ); 805 805 806 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) );806 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => bp_displayed_user_id(), 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) ); 807 807 } 808 808 … … 829 829 830 830 if ( empty( $user_id ) ) 831 $user_id = $bp->displayed_user->id;831 $user_id = bp_displayed_user_id(); 832 832 833 833 $last_activity = bp_core_get_last_activity( bp_get_user_meta( $user_id, 'last_activity', true ), __('active %s', 'buddypress') ); … … 871 871 872 872 function bp_displayed_user_id() { 873 global $bp; 874 return apply_filters( 'bp_displayed_user_id', !empty( $bp->displayed_user->id ) ? $bp->displayed_user->id : 0 ); 873 874 static $id = 0; 875 876 if ( empty( $id ) ) { 877 global $bp; 878 $id = !empty( $bp->displayed_user->id ) ? $bp->displayed_user->id : 0; 879 } 880 881 return apply_filters( 'bp_displayed_user_id', $id ); 875 882 } 876 883 function bp_current_user_id() { return bp_displayed_user_id(); } 877 884 878 885 function bp_loggedin_user_id() { 879 global $bp; 880 return apply_filters( 'bp_loggedin_user_id', !empty( $bp->loggedin_user->id ) ? $bp->loggedin_user->id : 0 ); 886 887 static $id = 0; 888 889 if ( empty( $id ) ) { 890 global $bp; 891 $id = !empty( $bp->loggedin_user->id ) ? $bp->loggedin_user->id : 0; 892 } 893 894 return apply_filters( 'bp_loggedin_user_id', $id ); 881 895 } 882 896 … … 915 929 global $bp; 916 930 917 if ( !empty( $bp->displayed_user->id) ) {918 $username = bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );931 if ( bp_displayed_user_id() ) { 932 $username = bp_core_get_username( bp_displayed_user_id(), $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ); 919 933 } else { 920 934 $username = ''; … … 1171 1185 1172 1186 // Must be displayed user 1173 if ( empty( $bp->displayed_user->id) )1187 if ( !bp_displayed_user_id() ) 1174 1188 return; 1175 1189
Note: See TracChangeset
for help on using the changeset viewer.