Changeset 1844 for trunk/bp-friends/bp-friends-templatetags.php
- Timestamp:
- 09/10/2009 06:34:52 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-friends/bp-friends-templatetags.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-templatetags.php
r1834 r1844 172 172 173 173 $friends_template = new BP_Friendship_Template( $user_id, $type, $per_page, $max, $filter ); 174 return $friends_template->has_friendships();174 return apply_filters( 'bp_has_friendships', $friends_template->has_friendships(), &$friends_template ); 175 175 } 176 176 … … 345 345 346 346 function bp_add_friend_button( $potential_friend_id = false ) { 347 global $bp, $friends_template; 348 349 if ( is_user_logged_in() ) { 350 351 if ( !$potential_friend_id && $friends_template->friendship->friend ) 352 $potential_friend_id = $friends_template->friendship->friend->id; 353 else if ( !$potential_friend_id && !$friends_template->friendship->friend ) 354 $potential_friend_id = $bp->displayed_user->id; 355 356 if ( $bp->loggedin_user->id == $potential_friend_id ) 357 return false; 358 359 $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id ); 360 361 echo '<div class="generic-button friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">'; 362 if ( 'pending' == $friend_status ) { 363 echo '<a class="requested" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>'; 364 } else if ( 'is_friend' == $friend_status ) { 365 echo '<a href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id, 'friends_remove_friend' ) . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>'; 366 } else { 367 echo '<a href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id, 'friends_add_friend' ) . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>'; 368 } 369 echo '</div>'; 370 } 371 } 347 echo bp_get_add_friend_button(); 348 } 349 function bp_get_add_friend_button( $potential_friend_id = false ) { 350 global $bp, $friends_template; 351 352 $button = false; 353 354 if ( is_user_logged_in() ) { 355 356 if ( !$potential_friend_id && $friends_template->friendship->friend ) 357 $potential_friend_id = $friends_template->friendship->friend->id; 358 else if ( !$potential_friend_id && !$friends_template->friendship->friend ) 359 $potential_friend_id = $bp->displayed_user->id; 360 361 if ( $bp->loggedin_user->id == $potential_friend_id ) 362 return false; 363 364 $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id ); 365 366 $button = '<div class="generic-button friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">'; 367 if ( 'pending' == $friend_status ) { 368 $button .= '<a class="requested" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>'; 369 } else if ( 'is_friend' == $friend_status ) { 370 $button .= '<a href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id, 'friends_remove_friend' ) . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>'; 371 } else { 372 $button .= '<a href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id, 'friends_add_friend' ) . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>'; 373 } 374 $button .= '</div>'; 375 } 376 377 return apply_filters( 'bp_get_add_friend_button', $button ); 378 } 372 379 373 380 function bp_friends_header_tabs() {
Note: See TracChangeset
for help on using the changeset viewer.