Changeset 5712
- Timestamp:
- 02/11/2012 04:42:04 AM (13 years ago)
- Location:
- trunk/bp-friends
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-actions.php
r4961 r5712 1 1 <?php 2 2 3 /** 4 * BuddyPress Friends Actions 5 * 3 6 * Action functions are exactly the same as screen functions, however they do not 4 7 * have a template screen associated with them. Usually they will send the user 5 8 * back to the default screen after execution. 9 * 10 * @package BuddyPress 11 * @subpackage FriendsActions 6 12 */ 7 13 -
trunk/bp-friends/bp-friends-activity.php
r5437 r5712 1 1 <?php 2 2 3 /** 3 * These functions handle the recording, deleting and formatting of activity and 4 * notifications for the user and for this specific component. 4 * BuddyPress Friends Activity Functions 5 * 6 * These functions handle the recording, deleting and formatting of activity 7 * for the user and for this specific component. 8 * 9 * @package BuddyPress 10 * @subpackage FriendsActivity 5 11 */ 6 12 … … 37 43 38 44 if ( bp_is_active( 'activity' ) ) { 39 extract( (array) $args );45 extract( (array) $args ); 40 46 bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->friends->id, 'type' => $type, 'user_id' => $user_id ) ); 41 47 } … … 71 77 */ 72 78 function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 73 global $bp;74 79 75 80 switch ( $action ) { … … 110 115 'link' => $link, 111 116 'text' => $text 112 ), (int) $total_items );117 ), (int) $total_items ); 113 118 } 114 119 -
trunk/bp-friends/bp-friends-cache.php
r5302 r5712 1 1 <?php 2 2 3 /** 4 * BuddyPress Friends Caching 5 * 3 6 * Caching functions handle the clearing of cached objects and pages on specific 4 7 * actions throughout BuddyPress. 8 * 9 * @package BuddyPress 10 * @subpackage FriendsCaching 5 11 */ 12 6 13 7 14 // Exit if accessed directly -
trunk/bp-friends/bp-friends-functions.php
r5676 r5712 1 1 <?php 2 /******************************************************************************** 3 * Business Functions 2 3 /** 4 * BuddyPress Friends Functions 4 5 * 5 * Business functions are where all the magic happens in BuddyPress. They will6 * Functions are where all the magic happens in BuddyPress. They will 6 7 * handle the actual saving or manipulation of information. Usually they will 7 8 * hand off to a database class for data access, then return 8 9 * true or false on success or failure. 10 * 11 * @package BuddyPress 12 * @subpackage FriendsFunctions 9 13 */ 10 14 … … 53 57 54 58 function friends_remove_friend( $initiator_userid, $friend_userid ) { 55 global $bp;56 59 57 60 $friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid ); … … 138 141 139 142 function friends_check_friendship( $user_id, $possible_friend_id ) { 140 global $bp;141 143 142 144 if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ) ) … … 152 154 153 155 function friends_get_total_friend_count( $user_id = 0 ) { 154 global $bp; 155 156 if ( !$user_id ) 156 157 if ( empty( $user_id ) ) 157 158 $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); 158 159 … … 182 183 } 183 184 184 function friends_get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false , $filter = false) {185 function friends_get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) { 185 186 return BP_Friends_Friendship::get_friend_user_ids( $user_id, $friend_requests_only, $assoc_arr ); 186 187 } … … 293 294 294 295 function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 ) { 295 global $bp;296 296 297 297 $user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page ); 298 298 299 if ( !$user_ids)299 if ( empty( $user_ids ) ) 300 300 return false; 301 301 302 $users = array(); 302 303 for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i ) 303 304 $users[] = new BP_Core_User( $user_ids[$i] ); … … 312 313 313 314 function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) { 314 global $bp;315 315 316 316 if ( 'add' == $status ) { … … 328 328 do_action( 'friends_before_remove_data', $user_id ); 329 329 330 BP_Friends_Friendship::delete_all_for_user( $user_id);330 BP_Friends_Friendship::delete_all_for_user( $user_id ); 331 331 332 332 // Remove usermeta -
trunk/bp-friends/bp-friends-notifications.php
r5416 r5712 1 1 <?php 2 3 /** 4 * BuddyPress Friends Activity Functions 5 * 6 * These functions handle the recording, deleting and formatting of activity 7 * for the user and for this specific component. 8 * 9 * @package BuddyPress 10 * @subpackage FriendsActivity 11 */ 12 2 13 // Exit if accessed directly 3 14 if ( !defined( 'ABSPATH' ) ) exit; 4 15 5 16 function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) { 6 global $bp;7 17 8 18 $initiator_name = bp_core_get_user_displayname( $initiator_id ); … … 11 21 return false; 12 22 13 $ud = get_userdata( $friend_id ); 14 $initiator_ud = get_userdata( $initiator_id ); 15 23 $ud = get_userdata( $friend_id ); 16 24 $all_requests_link = bp_core_get_user_domain( $friend_id ) . bp_get_friends_slug() . '/requests/'; 17 $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';18 $settings_link = trailingslashit( bp_core_get_user_domain( $friend_id ) . $settings_slug . '/notifications' );19 $initiator_link = bp_core_get_user_domain( $initiator_id );25 $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; 26 $settings_link = trailingslashit( bp_core_get_user_domain( $friend_id ) . $settings_slug . '/notifications' ); 27 $initiator_link = bp_core_get_user_domain( $initiator_id ); 20 28 21 29 // Set up and send the message … … 47 55 48 56 function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) { 49 global $bp;50 51 $friendship = new BP_Friends_Friendship( $friendship_id, false, false );52 57 53 58 $friend_name = bp_core_get_user_displayname( $friend_id ); 54 59 55 if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) )60 if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) ) 56 61 return false; 57 62 58 $ud = get_userdata( $initiator_id ); 59 63 $ud = get_userdata( $initiator_id ); 60 64 $friend_link = bp_core_get_user_domain( $friend_id ); 61 65 $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; -
trunk/bp-friends/bp-friends-screens.php
r5416 r5712 1 1 <?php 2 2 3 /** 4 * BuddyPress Friends Screen Functions 5 * 3 6 * Screen functions are the controllers of BuddyPress. They will execute when their 4 7 * specific URL is caught. They will first save or manipulate data using business 5 8 * functions, then pass on the user to a template file. 9 * 10 * @package BuddyPress 11 * @subpackage FriendsScreens 6 12 */ 7 13 … … 53 59 54 60 function friends_screen_notification_settings() { 55 global $bp;56 61 57 62 if ( !$send_requests = bp_get_user_meta( bp_displayed_user_id(), 'notification_friends_friendship_request', true ) ) … … 59 64 60 65 if ( !$accept_requests = bp_get_user_meta( bp_displayed_user_id(), 'notification_friends_friendship_accepted', true ) ) 61 $accept_requests = 'yes'; 62 ?> 66 $accept_requests = 'yes'; ?> 63 67 64 68 <table class="notification-settings" id="friends-notification-settings"> -
trunk/bp-friends/bp-friends-template.php
r5704 r5712 1 1 <?php 2 3 /** 4 * BuddyPress Friends Template Functions 5 * 6 * @package BuddyPress 7 * @subpackage FriendsTemplate 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; … … 58 66 */ 59 67 function bp_friends_header_tabs() { 60 global $bp;?>68 ?> 61 69 62 70 <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/recently-active' ) ?>"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li> … … 91 99 92 100 function bp_friends_random_friends() { 93 global $bp;94 101 95 102 if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) { … … 123 130 124 131 <?php } ?> 132 125 133 <div class="clear"></div> 126 134 </div> 135 127 136 <?php 128 137 } … … 138 147 */ 139 148 function bp_friends_random_members( $total_members = 5 ) { 140 global $bp;141 149 142 150 if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) { … … 196 204 197 205 function bp_friend_search_form() { 198 global $friends_template, $bp;199 206 200 207 $action = bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/search/'; 201 $label = __( 'Filter Friends', 'buddypress' ); ?>208 $label = __( 'Filter Friends', 'buddypress' ); ?> 202 209 203 210 <form action="<?php echo $action ?>" id="friend-search-form" method="post"> … … 228 235 229 236 function bp_member_total_friend_count() { 230 global $members_template;231 232 237 echo bp_get_member_total_friend_count(); 233 238 } … … 257 262 * Returns the ID of the potential friend 258 263 * 259 * @global object $bp260 264 * @global object $friends_template 261 265 * @param int $user_id … … 263 267 */ 264 268 function bp_get_potential_friend_id( $user_id = 0 ) { 265 global $ bp, $friends_template;269 global $friends_template; 266 270 267 271 if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) ) … … 278 282 * Returns - 'is_friend', 'not_friends', 'pending' 279 283 * 280 * @global object $bp281 284 * @param int $potential_friend_id 282 285 * @return string 283 286 */ 284 287 function bp_is_friend( $user_id = 0 ) { 285 global $bp;286 288 287 289 if ( !is_user_logged_in() ) … … 301 303 } 302 304 function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) { 303 global $bp, $friends_template;304 305 305 306 if ( empty( $potential_friend_id ) ) … … 367 368 368 369 function bp_get_friend_ids( $user_id = 0 ) { 369 global $bp; 370 371 if ( !$user_id ) 370 371 if ( empty( $user_id ) ) 372 372 $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); 373 373 … … 380 380 } 381 381 function bp_get_friendship_requests() { 382 global $bp;383 384 382 return apply_filters( 'bp_get_friendship_requests', implode( ',', (array) friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) ) ); 385 383 } … … 389 387 } 390 388 function bp_get_friend_friendship_id() { 391 global $members_template , $bp;389 global $members_template; 392 390 393 391 if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { … … 403 401 } 404 402 function bp_get_friend_accept_request_link() { 405 global $members_template , $bp;403 global $members_template; 406 404 407 405 if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { … … 417 415 } 418 416 function bp_get_friend_reject_request_link() { 419 global $members_template , $bp;417 global $members_template; 420 418 421 419 if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { … … 439 437 } 440 438 function bp_friend_get_total_requests_count( $user_id = 0 ) { 441 global $bp;442 443 439 if ( empty( $user_id ) ) 444 440 $user_id = bp_loggedin_user_id();
Note: See TracChangeset
for help on using the changeset viewer.