Changeset 7560
- Timestamp:
- 11/11/2013 02:03:09 AM (11 years ago)
- Location:
- trunk/bp-friends
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-screens.php
r7537 r7560 4 4 * BuddyPress Friends Screen Functions 5 5 * 6 * Screen functions are the controllers of BuddyPress. They will execute when their7 * specific URL is caught. They will first save or manipulate data using business8 * functions, then pass on the user to a template file.6 * Screen functions are the controllers of BuddyPress. They will execute when 7 * their specific URL is caught. They will first save or manipulate data using 8 * business functions, then pass on the user to a template file. 9 9 * 10 10 * @package BuddyPress … … 15 15 if ( !defined( 'ABSPATH' ) ) exit; 16 16 17 /** 18 * Catch and process the My Friends page. 19 */ 17 20 function friends_screen_my_friends() { 18 21 … … 25 28 } 26 29 30 /** 31 * Catch and process the Requests page. 32 */ 27 33 function friends_screen_requests() { 28 34 if ( bp_is_action_variable( 'accept', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { … … 69 75 } 70 76 77 /** 78 * Add Friends-related settings to the Settings > Notifications page. 79 */ 71 80 function friends_screen_notification_settings() { 72 81 -
trunk/bp-friends/bp-friends-template.php
r7374 r7560 2 2 3 3 /** 4 * BuddyPress Friends Template Functions 4 * BuddyPress Friends Template Functions. 5 5 * 6 6 * @package BuddyPress … … 12 12 13 13 /** 14 * Output the friends component slug 15 * 16 * @package BuddyPress 17 * @subpackage Friends Template 18 * @since BuddyPress (1.5) 14 * Output the friends component slug. 15 * 16 * @since BuddyPress (1.5.0) 19 17 * 20 18 * @uses bp_get_friends_slug() … … 24 22 } 25 23 /** 26 * Return the friends component slug 27 * 28 * @package BuddyPress 29 * @subpackage Friends Template 30 * @since BuddyPress (1.5) 24 * Return the friends component slug. 25 * 26 * @since BuddyPress (1.5.0) 31 27 */ 32 28 function bp_get_friends_slug() { … … 36 32 37 33 /** 38 * Output the friends component root slug 39 * 40 * @package BuddyPress 41 * @subpackage Friends Template 42 * @since BuddyPress (1.5) 34 * Output the friends component root slug. 35 * 36 * @since BuddyPress (1.5.0) 43 37 * 44 38 * @uses bp_get_friends_root_slug() … … 48 42 } 49 43 /** 50 * Return the friends component root slug 51 * 52 * @package BuddyPress 53 * @subpackage Friends Template 54 * @since BuddyPress (1.5) 44 * Return the friends component root slug. 45 * 46 * @since BuddyPress (1.5.0) 55 47 */ 56 48 function bp_get_friends_root_slug() { … … 59 51 } 60 52 53 /** 54 * Output a block of random friends. 55 * 56 * No longer used in BuddyPress. 57 * 58 * @todo Deprecate 59 */ 61 60 function bp_friends_random_friends() { 62 61 … … 99 98 100 99 /** 101 * Pull up a group of random members, and display some profile data about them 100 * Pull up a group of random members, and display some profile data about them. 102 101 * 103 102 * This function is no longer used by BuddyPress core. 104 103 * 105 * @ package BuddyPress106 * 107 * @param int $total_members The number of members to retrieve 104 * @todo Deprecate 105 * 106 * @param int $total_members The number of members to retrieve. 108 107 */ 109 108 function bp_friends_random_members( $total_members = 5 ) { … … 164 163 } 165 164 165 /** 166 * Display a Friends search form. 167 * 168 * No longer used in BuddyPress. 169 * 170 * @todo Deprecate 171 */ 166 172 function bp_friend_search_form() { 167 173 … … 183 189 } 184 190 191 /** 192 * Output the Add Friend button in member directories. 193 */ 185 194 function bp_member_add_friend_button() { 186 195 global $members_template; … … 195 204 add_action( 'bp_directory_members_actions', 'bp_member_add_friend_button' ); 196 205 206 /** 207 * Output the friend count for the current member in the loop. 208 */ 197 209 function bp_member_total_friend_count() { 198 210 echo bp_get_member_total_friend_count(); 199 211 } 212 /** 213 * Return the friend count for the current member in the loop. 214 * 215 * Return value is a string of the form "x friends". 216 * 217 * @return string A string of the form "x friends". 218 */ 200 219 function bp_get_member_total_friend_count() { 201 220 global $members_template; … … 208 227 209 228 /** 210 * bp_potential_friend_id( $user_id ) 211 * 212 * Outputs the ID of the potential friend 213 * 214 * @uses bp_get_potential_friend_id() 215 * @param int $user_id Optional 229 * Output the ID of the current user in the friend request loop. 230 * 231 * @see bp_get_potential_friend_id() for a description of arguments. 232 * 233 * @param int $user_id See {@link bp_get_potential_friend_id()}. 216 234 */ 217 235 function bp_potential_friend_id( $user_id = 0 ) { … … 219 237 } 220 238 /** 221 * bp_get_potential_friend_id( $user_id ) 222 * 223 * Returns the ID of the potential friend 239 * Return the ID of current user in the friend request loop. 224 240 * 225 241 * @global object $friends_template 226 * @param int $user_id 227 * @return int ID of potential friend 242 * 243 * @param int $user_id Optional. If provided, the function will simply 244 * return this value. 245 * @return int ID of potential friend. 228 246 */ 229 247 function bp_get_potential_friend_id( $user_id = 0 ) { … … 239 257 240 258 /** 241 * bp_is_friend( $user_id ) 242 * 243 * Returns - 'is_friend', 'not_friends', 'pending' 244 * 245 * @param int $potential_friend_id 246 * @return string 259 * Check whether a given user is a friend of the logged-in user. 260 * 261 * Returns - 'is_friend', 'not_friends', 'pending'. 262 * 263 * @param int $user_id ID of the potential friend. Default: the value of 264 * {@link bp_get_potential_friend_id()}. 265 * @return string 'is_friend', 'not_friends', or 'pending'. 247 266 */ 248 267 function bp_is_friend( $user_id = 0 ) { … … 260 279 } 261 280 281 /** 282 * Output the Add Friend button. 283 * 284 * @see bp_get_add_friend_button() for information on arguments. 285 * 286 * @param int $potential_friend_id See {@link bp_get_add_friend_button()}. 287 * @param int $friend_status See {@link bp_get_add_friend_button()}. 288 */ 262 289 function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false ) { 263 290 echo bp_get_add_friend_button( $potential_friend_id, $friend_status ); 264 291 } 292 /** 293 * Create the Add Friend button. 294 * 295 * @param int $potential_friend_id ID of the user to whom the button 296 * applies. Default: value of {@link bp_get_potential_friend_id()}. 297 * @param bool $friend_status Not currently used. 298 * @return string HTML for the Add Friend button. 299 */ 265 300 function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) { 266 301 … … 347 382 } 348 383 384 /** 385 * Get a comma-separated list of IDs of a user's friends. 386 * 387 * @param int $user_id Optional. Default: the displayed user's ID, or the 388 * logged-in user's ID. 389 * @return string|bool A comma-separated list of friend IDs if any are found, 390 * otherwise false. 391 */ 349 392 function bp_get_friend_ids( $user_id = 0 ) { 350 393 … … 361 404 362 405 /** 363 * Get a user's friendship requests 364 * 365 * Note that we return a 0 if no pending requests are found. This is necessary because of the 366 * structure of the $include parameter in bp_has_members(). 367 * 368 * @param int $user_id Defaults to displayed user 369 * @return mixed Returns an array of users if found, or a 0 if none are found 406 * Get a user's friendship requests. 407 * 408 * Note that we return a 0 if no pending requests are found. This is necessary 409 * because of the structure of the $include parameter in bp_has_members(). 410 * 411 * @param int $user_id ID of the user whose requests are being retrieved. 412 * Defaults to displayed user. 413 * @return array|int An array of user IDs if found, or a 0 if none are found. 370 414 */ 371 415 function bp_get_friendship_requests( $user_id = 0 ) { … … 389 433 } 390 434 435 /** 436 * Output the ID of the friendship between the logged-in user and the current user in the loop. 437 */ 391 438 function bp_friend_friendship_id() { 392 439 echo bp_get_friend_friendship_id(); 393 440 } 441 /** 442 * Return the ID of the frinedship between the logged-in user and the current user in the loop. 443 * 444 * @return int ID of the friendship. 445 */ 394 446 function bp_get_friend_friendship_id() { 395 447 global $members_template; … … 403 455 } 404 456 457 /** 458 * Output the URL for accepting the current friendship request in the loop. 459 */ 405 460 function bp_friend_accept_request_link() { 406 461 echo bp_get_friend_accept_request_link(); 407 462 } 463 /** 464 * Return the URL for accepting the current friendship request in the loop. 465 * 466 * @return string accept-friendship URL. 467 */ 408 468 function bp_get_friend_accept_request_link() { 409 469 global $members_template; … … 417 477 } 418 478 479 /** 480 * Output the URL for rejecting the current friendship request in the loop. 481 */ 419 482 function bp_friend_reject_request_link() { 420 483 echo bp_get_friend_reject_request_link(); 421 484 } 485 /** 486 * Return the URL for rejecting the current friendship request in the loop. 487 * 488 * @return string reject-friendship URL. 489 */ 422 490 function bp_get_friend_reject_request_link() { 423 491 global $members_template; … … 431 499 } 432 500 501 /** 502 * Output the total friend count for a given user. 503 * 504 * @param int $user_id See {@link friends_get_total_friend_count()}. 505 */ 433 506 function bp_total_friend_count( $user_id = 0 ) { 434 507 echo bp_get_total_friend_count( $user_id ); 435 508 } 509 /** 510 * Return the total friend count for a given user. 511 * 512 * @param int $user_id See {@link friends_get_total_friend_count()}. 513 * @return int Total friend count. 514 */ 436 515 function bp_get_total_friend_count( $user_id = 0 ) { 437 516 return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ) ); … … 439 518 add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' ); 440 519 520 /** 521 * Output the total friendship request count for a given user. 522 * 523 * @see bp_friend_get_total_requests_count() for description of arguments. 524 * 525 * @param int $user_id See {@link bp_friend_get_total_requests_count(). 526 */ 441 527 function bp_friend_total_requests_count( $user_id = 0 ) { 442 528 echo bp_friend_get_total_requests_count( $user_id ); 443 529 } 530 /** 531 * Return the total friendship request count for a given user. 532 * 533 * @param int $user_id ID of the user whose requests are being counted. 534 * Default: ID of the logged-in user. 535 * @return int Friend count. 536 */ 444 537 function bp_friend_get_total_requests_count( $user_id = 0 ) { 445 538 if ( empty( $user_id ) ) -
trunk/bp-friends/bp-friends-widgets.php
r7392 r7560 14 14 * Register the friends widget. 15 15 * 16 * @since 1.9.016 * @since BuddyPress (1.9.0) 17 17 */ 18 18 function bp_friends_register_widgets() { … … 30 30 * The User Friends widget class. 31 31 * 32 * @since 1.9.032 * @since BuddyPress (1.9.0) 33 33 */ 34 34 class BP_Core_Friends_Widget extends WP_Widget { … … 193 193 * Process AJAX pagination or filtering for the Friends widget. 194 194 * 195 * @since 1.9.0195 * @since BuddyPress (1.9.0) 196 196 */ 197 197 function bp_core_ajax_widget_friends() {
Note: See TracChangeset
for help on using the changeset viewer.