Changeset 8335
- Timestamp:
- 05/01/2014 01:58:27 AM (10 years ago)
- Location:
- trunk/bp-members
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-screens.php
r8119 r8335 4 4 * BuddyPress Member Screens 5 5 * 6 * Handlers for member screens that aren't handled elsewhere 6 * Handlers for member screens that aren't handled elsewhere. 7 7 * 8 8 * @package BuddyPress … … 14 14 15 15 /** 16 * Handles the display of the profile page by loading the correct template file. 17 * 18 * @package BuddyPress Members 19 * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename) 16 * Handle the display of the profile page by loading the correct template file. 20 17 */ 21 18 function bp_members_screen_display_profile() { … … 25 22 26 23 /** 27 * Handles the display of the members directory index 28 * 29 * @global object $bp 30 * 31 * @uses bp_is_user() 32 * @uses bp_is_current_component() 33 * @uses do_action() 34 * @uses bp_core_load_template() 35 * @uses apply_filters() 24 * Handle the display of the members directory index. 36 25 */ 37 26 function bp_members_screen_index() { … … 46 35 add_action( 'bp_screens', 'bp_members_screen_index' ); 47 36 48 37 /** 38 * Handle the loading of the signup screen. 39 */ 49 40 function bp_core_screen_signup() { 50 41 global $bp; … … 221 212 add_action( 'bp_screens', 'bp_core_screen_signup' ); 222 213 214 /** 215 * Handle the loading of the Activate screen. 216 */ 223 217 function bp_core_screen_activation() { 224 218 global $bp; … … 268 262 add_action( 'bp_screens', 'bp_core_screen_activation' ); 269 263 270 /** Theme Compat ability *******************************************************/264 /** Theme Compatibility *******************************************************/ 271 265 272 266 /** 273 267 * The main theme compat class for BuddyPress Members. 274 268 * 275 * This class sets up the necessary theme compat ability actions to safely output269 * This class sets up the necessary theme compatibility actions to safely output 276 270 * member template parts to the_title and the_content areas of a theme. 277 271 * 278 * @since BuddyPress (1.7 )272 * @since BuddyPress (1.7.0) 279 273 */ 280 274 class BP_Members_Theme_Compat { 281 275 282 276 /** 283 * Set up the members component theme compatibility284 * 285 * @since BuddyPress (1.7 )277 * Set up the members component theme compatibility. 278 * 279 * @since BuddyPress (1.7.0) 286 280 */ 287 281 public function __construct() { … … 290 284 291 285 /** 292 * Are we looking at something that needs members theme compat ability?293 * 294 * @since BuddyPress (1.7 )286 * Are we looking at something that needs members theme compatibility? 287 * 288 * @since BuddyPress (1.7.0) 295 289 */ 296 290 public function is_members() { … … 331 325 * Add template hierarchy to theme compat for the members directory page. 332 326 * 333 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 334 * 335 * @since BuddyPress (1.8) 336 * 337 * @param string $templates The templates from bp_get_theme_compat_templates() 327 * This is to mirror how WordPress has 328 * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 329 * 330 * @since BuddyPress (1.8.0) 331 * 332 * @param string $templates The templates from bp_get_theme_compat_templates(). 338 333 * @return array $templates Array of custom templates to look for. 339 334 */ … … 353 348 354 349 /** 355 * Update the global $post with directory data 356 * 357 * @since BuddyPress (1.7 )350 * Update the global $post with directory data. 351 * 352 * @since BuddyPress (1.7.0) 358 353 */ 359 354 public function directory_dummy_post() { … … 372 367 373 368 /** 374 * Filter the_content with the members index template part 375 * 376 * @since BuddyPress (1.7 )369 * Filter the_content with the members index template part. 370 * 371 * @since BuddyPress (1.7.0) 377 372 */ 378 373 public function directory_content() { … … 385 380 * Add custom template hierarchy to theme compat for member pages. 386 381 * 387 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 388 * 389 * @since BuddyPress (1.8) 390 * 391 * @param string $templates The templates from bp_get_theme_compat_templates() 382 * This is to mirror how WordPress has 383 * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 384 * 385 * @since BuddyPress (1.8.0) 386 * 387 * @param string $templates The templates from 388 * bp_get_theme_compat_templates(). 392 389 * @return array $templates Array of custom templates to look for. 393 390 */ … … 413 410 414 411 /** 415 * Update the global $post with the displayed user's data 416 * 417 * @since BuddyPress (1.7 )412 * Update the global $post with the displayed user's data. 413 * 414 * @since BuddyPress (1.7.0) 418 415 */ 419 416 public function single_dummy_post() { … … 432 429 433 430 /** 434 * Filter the_content with the members' single home template part 435 * 436 * @since BuddyPress (1.7 )431 * Filter the_content with the members' single home template part. 432 * 433 * @since BuddyPress (1.7.0) 437 434 */ 438 435 public function single_dummy_content() { … … 448 445 * registration template parts to the_title and the_content areas of a theme. 449 446 * 450 * @since BuddyPress (1.7 )447 * @since BuddyPress (1.7.0) 451 448 */ 452 449 class BP_Registration_Theme_Compat { … … 455 452 * Setup the groups component theme compatibility 456 453 * 457 * @since BuddyPress (1.7 )454 * @since BuddyPress (1.7.0) 458 455 */ 459 456 public function __construct() { … … 464 461 * Are we looking at either the registration or activation pages? 465 462 * 466 * @since BuddyPress (1.7 )463 * @since BuddyPress (1.7.0) 467 464 */ 468 465 public function is_registration() { … … 485 482 486 483 /** 487 * Add template hierarchy to theme compat for registration / activation pages. 488 * 489 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 490 * 491 * @since BuddyPress (1.8) 492 * 493 * @param string $templates The templates from bp_get_theme_compat_templates() 484 * Add template hierarchy to theme compat for registration/activation pages. 485 * 486 * This is to mirror how WordPress has 487 * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 488 * 489 * @since BuddyPress (1.8.0) 490 * 491 * @param string $templates The templates from bp_get_theme_compat_templates(). 494 492 * @return array $templates Array of custom templates to look for. 495 493 */ … … 510 508 511 509 /** 512 * Update the global $post with dummy data 513 * 514 * @since BuddyPress (1.7 )510 * Update the global $post with dummy data. 511 * 512 * @since BuddyPress (1.7.0) 515 513 */ 516 514 public function dummy_post() { … … 550 548 * Filter the_content with either the register or activate templates. 551 549 * 552 * @since BuddyPress (1.7 )550 * @since BuddyPress (1.7.0) 553 551 */ 554 552 public function dummy_content() { -
trunk/bp-members/bp-members-template.php
r8142 r8335 4 4 * BuddyPress Member Template Tags 5 5 * 6 * Functions that are safe to use inside your template files and themes 6 * Functions that are safe to use inside your template files and themes. 7 7 * 8 8 * @package BuddyPress … … 14 14 15 15 /** 16 * Output the members component slug 17 * 18 * @package BuddyPress 19 * @subpackage Members Template 20 * @since BuddyPress (1.5) 16 * Output the members component slug. 17 * 18 * @since BuddyPress (1.5.0) 21 19 * 22 20 * @uses bp_get_members_slug() … … 26 24 } 27 25 /** 28 * Return the members component slug 29 * 30 * @ package BuddyPress31 * @subpackage Members Template32 * @ since BuddyPress (1.5)26 * Return the members component slug. 27 * 28 * @since BuddyPress (1.5.0) 29 * 30 * @return string 33 31 */ 34 32 function bp_get_members_slug() { … … 37 35 38 36 /** 39 * Output the members component root slug 40 * 41 * @package BuddyPress 42 * @subpackage Members Template 43 * @since BuddyPress (1.5) 37 * Output the members component root slug. 38 * 39 * @since BuddyPress (1.5.0) 44 40 * 45 41 * @uses bp_get_members_root_slug() … … 49 45 } 50 46 /** 51 * Return the members component root slug 52 * 53 * @ package BuddyPress54 * @subpackage Members Template55 * @ since BuddyPress (1.5)47 * Return the members component root slug. 48 * 49 * @since BuddyPress (1.5.0) 50 * 51 * @return string 56 52 */ 57 53 function bp_get_members_root_slug() { … … 60 56 61 57 /** 62 * Output member directory permalink 63 * 64 * @package BuddyPress 65 * @subpackage Members Template 66 * @since BuddyPress (1.5) 58 * Output member directory permalink. 59 * 60 * @since BuddyPress (1.5.0) 61 * 67 62 * @uses bp_get_members_directory_permalink() 68 63 */ … … 71 66 } 72 67 /** 73 * Return member directory permalink 74 * 75 * @package BuddyPress 76 * @subpackage Members Template 77 * @since BuddyPress (1.5) 78 * @uses apply_filters() 79 * @uses traisingslashit() 80 * @uses bp_get_root_domain() 81 * @uses bp_get_members_root_slug() 68 * Return member directory permalink. 69 * 70 * @since BuddyPress (1.5.0) 71 * 82 72 * @return string 83 73 */ … … 87 77 88 78 /** 89 * Output the sign-up slug 90 * 91 * @package BuddyPress 92 * @subpackage Members Template 93 * @since BuddyPress (1.5) 79 * Output the sign-up slug. 80 * 81 * @since BuddyPress (1.5.0) 94 82 * 95 83 * @uses bp_get_signup_slug() … … 99 87 } 100 88 /** 101 * Return the sign-up slug 102 * 103 * @ package BuddyPress104 * @subpackage Members Template105 * @ since BuddyPress (1.5)89 * Return the sign-up slug. 90 * 91 * @since BuddyPress (1.5.0) 92 * 93 * @return string 106 94 */ 107 95 function bp_get_signup_slug() { … … 120 108 121 109 /** 122 * Output the activation slug 123 * 124 * @package BuddyPress 125 * @subpackage Members Template 126 * @since BuddyPress (1.5) 110 * Output the activation slug. 111 * 112 * @since BuddyPress (1.5.0) 127 113 * 128 114 * @uses bp_get_activate_slug() … … 132 118 } 133 119 /** 134 * Return the activation slug 135 * 136 * @ package BuddyPress137 * @subpackage Members Template138 * @ since BuddyPress (1.5)120 * Return the activation slug. 121 * 122 * @since BuddyPress (1.5.0) 123 * 124 * @return string 139 125 */ 140 126 function bp_get_activate_slug() { … … 152 138 } 153 139 154 /** *155 * Members template loop that will allow you to loop all members or friends of a member156 * if you pass a user_id.157 * /158 140 /** 141 * The main member template loop class. 142 * 143 * Responsible for loading a group of members into a loop for display. 144 */ 159 145 class BP_Core_Members_Template { 146 147 /** 148 * The loop iterator. 149 * 150 * @access public 151 * @var int 152 */ 160 153 var $current_member = -1; 154 155 /** 156 * The number of members returned by the paged query. 157 * 158 * @access public 159 * @var int 160 */ 161 161 var $member_count; 162 163 /** 164 * Array of members located by the query. 165 * 166 * @access public 167 * @var array 168 */ 162 169 var $members; 170 171 /** 172 * The member object currently being iterated on. 173 * 174 * @access public 175 * @var object 176 */ 163 177 var $member; 164 178 179 /** 180 * A flag for whether the loop is currently being iterated. 181 * 182 * @access public 183 * @var bool 184 */ 165 185 var $in_the_loop; 166 186 187 /** 188 * The page number being requested. 189 * 190 * @access public 191 * @var public 192 */ 167 193 var $pag_page; 194 195 /** 196 * The number of items being requested per page. 197 * 198 * @access public 199 * @var public 200 */ 168 201 var $pag_num; 202 203 /** 204 * An HTML string containing pagination links. 205 * 206 * @access public 207 * @var string 208 */ 169 209 var $pag_links; 210 211 /** 212 * The total number of members matching the query parameters. 213 * 214 * @access public 215 * @var int 216 */ 170 217 var $total_member_count; 171 218 219 /** 220 * Constructor method. 221 * 222 * @see BP_User_Query for an in-depth description of parameters. 223 * 224 * @param string $type Sort order. 225 * @param int $page_number Page of results. 226 * @param int $per_page Number of results per page. 227 * @param int $max Max number of results to return. 228 * @param int $user_id Limit to friends of a user. 229 * @param string $search_terms Limit to users matching search terms. 230 * @param array $include Limit results by these user IDs. 231 * @param bool $populate_extras Fetch optional extras. 232 * @param array $exclude Exclude these IDs from results. 233 * @param array $meta_key Limit to users with a meta_key. 234 * @param array $meta_value Limit to users with a meta_value (with meta_key). 235 * @param array $page_arg Optional. The string used as a query 236 * parameter in pagination links. Default: 'upage'. 237 */ 172 238 function __construct( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage' ) { 173 239 … … 211 277 } 212 278 279 /** 280 * Whether there are members available in the loop. 281 * 282 * @see bp_has_members() 283 * 284 * @return bool True if there are items in the loop, otherwise false. 285 */ 213 286 function has_members() { 214 287 if ( $this->member_count ) … … 218 291 } 219 292 293 /** 294 * Set up the next member and iterate index. 295 * 296 * @return object The next member to iterate over. 297 */ 220 298 function next_member() { 221 299 $this->current_member++; … … 225 303 } 226 304 305 /** 306 * Rewind the members and reset member index. 307 */ 227 308 function rewind_members() { 228 309 $this->current_member = -1; … … 232 313 } 233 314 315 /** 316 * Whether there are members left in the loop to iterate over. 317 * 318 * This method is used by {@link bp_members()} as part of the while loop 319 * that controls iteration inside the members loop, eg: 320 * while ( bp_members() ) { ... 321 * 322 * @see bp_members() 323 * 324 * @return bool True if there are more members to show, otherwise false. 325 */ 234 326 function members() { 235 327 if ( $this->current_member + 1 < $this->member_count ) { … … 245 337 } 246 338 339 /** 340 * Set up the current member inside the loop. 341 * 342 * Used by {@link bp_the_member()} to set up the current member data 343 * while looping, so that template tags used during that iteration make 344 * reference to the current member. 345 * 346 * @see bp_the_member() 347 */ 247 348 function the_member() { 248 349 … … 256 357 } 257 358 359 /** 360 * Rewind the members and reset member index. 361 */ 258 362 function bp_rewind_members() { 259 363 global $members_template; … … 262 366 } 263 367 368 /** 369 * Initialize the members loop. 370 * 371 * Based on the $args passed, bp_has_members() populates the $members_template 372 * global, enabling the use of BuddyPress templates and template functions to 373 * display a list of members. 374 * 375 * @global object $members_template {@link BP_Members_Template} 376 * 377 * @param array $args { 378 * Arguments for limiting the contents of the members loop. Most arguments 379 * are in the same format as {@link BP_User_Query}. However, because 380 * the format of the arguments accepted here differs in a number of ways, 381 * and because bp_has_members() determines some default arguments in a 382 * dynamic fashion, we list all accepted arguments here as well. 383 * 384 * Arguments can be passed as an associative array, or as a URL query 385 * string (eg, 'user_id=4&per_page=3'). 386 * 387 * @type int $type Sort order. 'active', 'random', 'newest', 'popular', 388 * 'online', 'alphabetical'. Default: 'active'. 389 * @type int|bool $page Page of results to display. Default: 1. 390 * @type int|bool $per_page Number of results per page. Default: 20. 391 * @type int|bool $max Maximum number of results to return. 392 * Default: false (unlimited). 393 * @type string $page_arg The string used as a query parameter in 394 * pagination links. Default: 'bpage'. 395 * @type array|int|string|bool $include Limit results by a list of user 396 * IDs. Accepts an array, a single integer, a comma-separated list of 397 * IDs, or false (to disable this limiting). Default: false. 398 * 'active', 'alphabetical', 'newest', or 'random'. 399 * @type array|int|string|bool $exclude Exclude users from results by ID. 400 * Accepts an array, a single integer, a comma-separated list of 401 * IDs, or false (to disable this limiting). Default: false. 402 * @type int $user_id If provided, results are limited to the friends of 403 * the specified user. When on a user's Friends page, defaults to 404 * the ID of the displayed user. Otherwise defaults to 0. 405 * @type string $search_terms Limit results by a search term. Default: null. 406 * @type string $meta_key Limit results by the presence of a usermeta key. 407 * Default: false. 408 * @type mixed $meta_value When used with meta_key, limits results by the 409 * a matching usermeta value. Default: false. 410 * @type bool $populate_extras Whether to fetch optional data, such as 411 * friend counts. Default: true. 412 * } 413 * @return bool Returns true when blogs are found, otherwise false. 414 */ 264 415 function bp_has_members( $args = '' ) { 265 416 global $members_template; … … 320 471 } 321 472 473 /** 474 * Set up the current member inside the loop. 475 * 476 * @return object 477 */ 322 478 function bp_the_member() { 323 479 global $members_template; … … 325 481 } 326 482 483 /** 484 * Check whether there are more members to iterate over. 485 * 486 * @return bool 487 */ 327 488 function bp_members() { 328 489 global $members_template; … … 330 491 } 331 492 493 /** 494 * Output the members pagination count. 495 */ 332 496 function bp_members_pagination_count() { 333 497 echo bp_get_members_pagination_count(); 334 498 } 499 /** 500 * Generate the members pagination count. 501 * 502 * @return string 503 */ 335 504 function bp_get_members_pagination_count() { 336 505 global $members_template; … … 356 525 } 357 526 527 /** 528 * Output the members pagination links. 529 */ 358 530 function bp_members_pagination_links() { 359 531 echo bp_get_members_pagination_links(); 360 532 } 533 /** 534 * Fetch the members pagination links. 535 * 536 * @return string 537 */ 361 538 function bp_get_members_pagination_links() { 362 539 global $members_template; … … 366 543 367 544 /** 368 * bp_member_user_id() 369 * 370 * Echo id from bp_get_member_user_id() 545 * Output the ID of the current member in the loop. 371 546 * 372 547 * @uses bp_get_member_user_id() … … 376 551 } 377 552 /** 378 * bp_get_member_user_id() 379 * 380 * Get the id of the user in a members loop 381 * 382 * @global object $members_template 383 * @return string Members id 553 * Get the ID of the current member in the loop. 554 * 555 * @return string Member ID. 384 556 */ 385 557 function bp_get_member_user_id() { … … 390 562 391 563 /** 392 * Output the row class of a member393 * 394 * @since BuddyPress (1.7 )564 * Output the row class of the current member in the loop. 565 * 566 * @since BuddyPress (1.7.0) 395 567 */ 396 568 function bp_member_class() { … … 398 570 } 399 571 /** 400 * Return the row class of a member401 * 402 * @ global BP_Core_Members_Template $members_template403 * @return string Row class of the member404 * @ since BuddyPress (1.7)572 * Return the row class of the current member in the loop. 573 * 574 * @since BuddyPress (1.7.0) 575 * 576 * @return string Row class of the member. 405 577 */ 406 578 function bp_get_member_class() { … … 431 603 432 604 /** 433 * bp_member_user_nicename() 434 * 435 * Echo nicename from bp_get_member_user_nicename() 436 * 437 * @uses bp_get_member_user_nicename() 605 * Output nicename of current member in the loop. 438 606 */ 439 607 function bp_member_user_nicename() { … … 441 609 } 442 610 /** 443 * bp_get_member_user_nicename() 444 * 445 * Get the nicename of the user in a members loop 446 * 447 * @global object $members_template 448 * @return string Members nicename 611 * Get the nicename of the current member in the loop. 612 * 613 * @return string Members nicename. 449 614 */ 450 615 function bp_get_member_user_nicename() { … … 454 619 455 620 /** 456 * bp_member_user_login() 457 * 458 * Echo login from bp_get_member_user_login() 459 * 460 * @uses bp_get_member_user_login() 621 * Output login for current member in the loop. 461 622 */ 462 623 function bp_member_user_login() { … … 464 625 } 465 626 /** 466 * bp_get_member_user_login() 467 * 468 * Get the login of the user in a members loop 469 * 470 * @global object $members_template 471 * @return string Members login 627 * Get the login of the current member in the loop. 628 * 629 * @return string Member's login. 472 630 */ 473 631 function bp_get_member_user_login() { … … 477 635 478 636 /** 479 * bp_member_user_email() 480 * 481 * Echo email address from bp_get_member_user_email() 482 * 483 * @uses bp_get_member_user_email() 637 * Output the email address for the current member in the loop. 484 638 */ 485 639 function bp_member_user_email() { … … 487 641 } 488 642 /** 489 * bp_get_member_user_email() 490 * 491 * Get the email address of the user in a members loop 492 * 493 * @global object $members_template 494 * @return string Members email address 643 * Get the email address of the current member in the loop. 644 * 645 * @return string Member's email address. 495 646 */ 496 647 function bp_get_member_user_email() { … … 499 650 } 500 651 652 /** 653 * Check whether the current member in the loop is the logged-in user. 654 * 655 * @return bool 656 */ 501 657 function bp_member_is_loggedin_user() { 502 658 global $members_template; … … 504 660 } 505 661 662 /** 663 * Output a member's avatar. 664 * 665 * @see bp_get_member_avatar() for description of arguments. 666 * 667 * @param array $args See {@link bp_get_member_avatar()}. 668 */ 506 669 function bp_member_avatar( $args = '' ) { 507 670 echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ) ); 508 671 } 672 /** 673 * Get a member's avatar. 674 * 675 * @see bp_core_fetch_avatar() For a description of arguments and 676 * return values. 677 * 678 * @param array $args { 679 * Arguments are listed here with an explanation of their defaults. 680 * For more information about the arguments, see 681 * {@link bp_core_fetch_avatar()}. 682 * @type string $alt Default: 'Profile picture of [user name]'. 683 * @type string $class Default: 'avatar'. 684 * @type string $type Default: 'thumb'. 685 * @type int|bool $width Default: false. 686 * @type int|bool $height Default: false. 687 * @type bool $id Currently unused. 688 * @type bool $no_grav Default: false. 689 * } 690 * @return string User avatar string. 691 */ 509 692 function bp_get_member_avatar( $args = '' ) { 510 693 global $members_template; … … 527 710 } 528 711 712 /** 713 * Output the permalink for the current member in the loop. 714 */ 529 715 function bp_member_permalink() { 530 716 echo bp_get_member_permalink(); 531 717 } 718 /** 719 * Get the permalink for the current member in the loop. 720 * 721 * @return string 722 */ 532 723 function bp_get_member_permalink() { 533 724 global $members_template; … … 535 726 return apply_filters( 'bp_get_member_permalink', bp_core_get_user_domain( $members_template->member->id, $members_template->member->user_nicename, $members_template->member->user_login ) ); 536 727 } 728 729 /** 730 * Alias of {@link bp_member_permalink()}. 731 */ 537 732 function bp_member_link() { echo bp_get_member_permalink(); } 733 734 /** 735 * Alias of {@link bp_get_member_permalink()}. 736 */ 538 737 function bp_get_member_link() { return bp_get_member_permalink(); } 539 738 540 739 /** 541 * Echoes bp_get_member_name() 542 * 543 * @package BuddyPress 740 * Output display name of current member in the loop. 544 741 */ 545 742 function bp_member_name() { … … 547 744 } 548 745 /** 549 * Used inside a bp_has_members() loop, this function returns a user's full name 550 * 551 * Full name is, by default, pulled from xprofile's Full Name field. When this field is 552 * empty, we try to get an alternative name from the WP users table, in the following order 553 * of preference: display_name, user_nicename, user_login. 554 * 555 * @package BuddyPress 556 * 557 * @uses apply_filters() Filter bp_get_the_member_name() to alter the function's output 558 * @return string The user's fullname for display 746 * Get the display name of the current member in the loop. 747 * 748 * Full name is, by default, pulled from xprofile's Full Name field. 749 * When this field is empty, we try to get an alternative name from the 750 * WP users table, in the following order of preference: display_name, 751 * user_nicename, user_login. 752 * 753 * @return string The user's fullname for display. 559 754 */ 560 755 function bp_get_member_name() { … … 625 820 } 626 821 822 /** 823 * Output the latest update of the current member in the loop. 824 */ 627 825 function bp_member_latest_update( $args = '' ) { 628 826 echo bp_get_member_latest_update( $args ); 629 827 } 828 /** 829 * Get the latest update from the current member in the loop. 830 * 831 * @param array $args { 832 * Array of optional arguments. 833 * @type int $length Truncation length. Default: 225. 834 * @type bool $view_link Whether to provide a 'View' link for 835 * truncated entries. Default: false. 836 * } 837 * @return string 838 */ 630 839 function bp_get_member_latest_update( $args = '' ) { 631 840 global $members_template; … … 730 939 } 731 940 941 /** 942 * Output the 'registered [x days ago]' string for the current member. 943 */ 732 944 function bp_member_registered() { 733 945 echo bp_get_member_registered(); 734 946 } 947 /** 948 * Get the 'registered [x days ago]' string for the current member. 949 * 950 * @return string 951 */ 735 952 function bp_get_member_registered() { 736 953 global $members_template; … … 741 958 } 742 959 960 /** 961 * Output a random piece of profile data for the current member in the loop. 962 */ 743 963 function bp_member_random_profile_data() { 744 964 global $members_template; … … 751 971 } 752 972 973 /** 974 * Output hidden input for preserving member search params on form submit. 975 */ 753 976 function bp_member_hidden_fields() { 754 977 if ( isset( $_REQUEST['s'] ) ) … … 762 985 } 763 986 987 /** 988 * Output the Members directory search form. 989 */ 764 990 function bp_directory_members_search_form() { 765 991 … … 775 1001 } 776 1002 1003 /** 1004 * Output the total member count. 1005 */ 777 1006 function bp_total_site_member_count() { 778 1007 echo bp_get_total_site_member_count(); 779 1008 } 1009 /** 1010 * Get the total site member count. 1011 * 1012 * @return int 1013 */ 780 1014 function bp_get_total_site_member_count() { 781 1015 return apply_filters( 'bp_get_total_site_member_count', bp_core_number_format( bp_core_get_total_member_count() ) ); 782 1016 } 783 1017 784 /** Navigation and other misc template tags **/ 785 786 /** 787 * Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install. 788 * Each component adds to this navigation array within its own [component_name]setup_nav() function. 1018 /** Navigation and other misc template tags ***********************************/ 1019 1020 /** 1021 * Render the navigation markup for the logged-in user. 1022 * 1023 * Each component adds to this navigation array within its own 1024 * [component_name]setup_nav() function. 789 1025 * 790 1026 * This navigation array is the top level navigation, so it contains items such as: 791 1027 * [Blog, Profile, Messages, Groups, Friends] ... 792 1028 * 793 * The function will also analyze the current component the user is in, to determine whether 794 * or not to highlight a particular nav item. 795 * 796 * @package BuddyPress Core 1029 * The function will also analyze the current component the user is in, to 1030 * determine whether or not to highlight a particular nav item. 1031 * 797 1032 * @todo Move to a back-compat file? 798 * @deprecated Does not seem to be called anywhere in the core 799 * @global BuddyPress $bp The one true BuddyPress instance 1033 * @deprecated Does not seem to be called anywhere in BP core. 800 1034 */ 801 1035 function bp_get_loggedin_user_nav() { … … 839 1073 840 1074 /** 841 * Uses the $bp->bp_nav global to render out the user navigation when viewing another user other than 842 * yourself. 843 * 844 * @package BuddyPress Core 845 * @global BuddyPress $bp The one true BuddyPress instance 1075 * Render the navigation markup for the displayed user. 846 1076 */ 847 1077 function bp_get_displayed_user_nav() { … … 869 1099 /** Avatars *******************************************************************/ 870 1100 1101 /** 1102 * Output the logged-in user's avatar. 1103 * 1104 * @see bp_get_loggedin_user_avatar() for a description of params. 1105 */ 871 1106 function bp_loggedin_user_avatar( $args = '' ) { 872 1107 echo bp_get_loggedin_user_avatar( $args ); 873 1108 } 1109 /** 1110 * Get the logged-in user's avatar. 1111 * 1112 * @see bp_core_fetch_avatar() For a description of arguments and 1113 * return values. 1114 * 1115 * @param array $args { 1116 * Arguments are listed here with an explanation of their defaults. 1117 * For more information about the arguments, see 1118 * {@link bp_core_fetch_avatar()}. 1119 * @type string $alt Default: 'Profile picture of [user name]'. 1120 * @type bool $html Default: true. 1121 * @type string $type Default: 'thumb'. 1122 * @type int|bool $width Default: false. 1123 * @type int|bool $height Default: false. 1124 * } 1125 * @return string User avatar string. 1126 */ 874 1127 function bp_get_loggedin_user_avatar( $args = '' ) { 875 1128 … … 888 1141 } 889 1142 1143 /** 1144 * Output the displayed user's avatar. 1145 * 1146 * @see bp_get_displayed_user_avatar() for a description of params. 1147 */ 890 1148 function bp_displayed_user_avatar( $args = '' ) { 891 1149 echo bp_get_displayed_user_avatar( $args ); 892 1150 } 1151 /** 1152 * Get the displayed user's avatar. 1153 * 1154 * @see bp_core_fetch_avatar() For a description of arguments and 1155 * return values. 1156 * 1157 * @param array $args { 1158 * Arguments are listed here with an explanation of their defaults. 1159 * For more information about the arguments, see 1160 * {@link bp_core_fetch_avatar()}. 1161 * @type string $alt Default: 'Profile picture of [user name]'. 1162 * @type bool $html Default: true. 1163 * @type string $type Default: 'thumb'. 1164 * @type int|bool $width Default: false. 1165 * @type int|bool $height Default: false. 1166 * } 1167 * @return string User avatar string. 1168 */ 893 1169 function bp_get_displayed_user_avatar( $args = '' ) { 894 1170 … … 907 1183 } 908 1184 1185 /** 1186 * Output the email address of the displayed user. 1187 */ 909 1188 function bp_displayed_user_email() { 910 1189 echo bp_get_displayed_user_email(); 911 1190 } 1191 /** 1192 * Get the email address of the displayed user. 1193 * 1194 * @return string 1195 */ 912 1196 function bp_get_displayed_user_email() { 913 1197 global $bp; … … 922 1206 } 923 1207 1208 /** 1209 * Output the "active [x days ago]" string for a user. 1210 * 1211 * @see bp_get_last_activity() for a description of parameters. 1212 * 1213 * @param int $user_id See {@link bp_get_last_activity()}. 1214 */ 924 1215 function bp_last_activity( $user_id = 0 ) { 925 1216 echo apply_filters( 'bp_last_activity', bp_get_last_activity( $user_id ) ); 926 1217 } 1218 /** 1219 * Get the "active [x days ago]" string for a user. 1220 * 1221 * @param int $user_id ID of the user. Default: displayed user ID. 1222 * @return string 1223 */ 927 1224 function bp_get_last_activity( $user_id = 0 ) { 928 1225 … … 935 1232 } 936 1233 1234 /** 1235 * Output the calculated first name of the displayed or logged-in user. 1236 */ 937 1237 function bp_user_firstname() { 938 1238 echo bp_get_user_firstname(); 939 1239 } 1240 /** 1241 * Output the first name of a user. 1242 * 1243 * Simply takes all the characters before the first space in a name. 1244 * 1245 * @param string $name Full name to use when generating first name. 1246 * Defaults to displayed user's first name, or to logged-in 1247 * user's first name if it's unavailable. 1248 * @return string 1249 */ 940 1250 function bp_get_user_firstname( $name = false ) { 941 1251 … … 953 1263 } 954 1264 1265 /** 1266 * Output the link for the logged-in user's profile. 1267 */ 955 1268 function bp_loggedin_user_link() { 956 1269 echo bp_get_loggedin_user_link(); 957 1270 } 1271 /** 1272 * Get the link for the logged-in user's profile. 1273 * 1274 * @return string 1275 */ 958 1276 function bp_get_loggedin_user_link() { 959 1277 return apply_filters( 'bp_get_loggedin_user_link', bp_loggedin_user_domain() ); 960 1278 } 961 1279 1280 /** 1281 * Output the link for the displayed user's profile. 1282 */ 962 1283 function bp_displayed_user_link() { 963 1284 echo bp_get_displayed_user_link(); 964 1285 } 1286 /** 1287 * Get the link for the displayed user's profile. 1288 * 1289 * @return string 1290 */ 965 1291 function bp_get_displayed_user_link() { 966 1292 return apply_filters( 'bp_get_displayed_user_link', bp_displayed_user_domain() ); 967 1293 } 968 function bp_user_link() { bp_displayed_user_domain(); } // Deprecated. 969 1294 1295 /** 1296 * Alias of {@link bp_displayed_user_domain()}. 1297 * 1298 * @deprecated 1299 */ 1300 function bp_user_link() { bp_displayed_user_domain(); } 1301 1302 /** 1303 * Alias of {@link bp_displayed_user_id()}. 1304 */ 970 1305 function bp_current_user_id() { return bp_displayed_user_id(); } 971 1306 1307 /** 1308 * Generate the link for the displayed user's profile. 1309 * 1310 * @return string 1311 */ 972 1312 function bp_displayed_user_domain() { 973 1313 global $bp; … … 975 1315 } 976 1316 1317 /** 1318 * Generate the link for the logged-in user's profile. 1319 * 1320 * @return string 1321 */ 977 1322 function bp_loggedin_user_domain() { 978 1323 global $bp; … … 980 1325 } 981 1326 1327 /** 1328 * Output the displayed user's display name. 1329 */ 982 1330 function bp_displayed_user_fullname() { 983 1331 echo bp_get_displayed_user_fullname(); 984 1332 } 1333 /** 1334 * Get the displayed user's display name. 1335 * 1336 * @return string 1337 */ 985 1338 function bp_get_displayed_user_fullname() { 986 1339 global $bp; 987 1340 return apply_filters( 'bp_displayed_user_fullname', isset( $bp->displayed_user->fullname ) ? $bp->displayed_user->fullname : '' ); 988 1341 } 1342 1343 /** 1344 * Alias of {@link bp_get_displayed_user_fullname()}. 1345 */ 989 1346 function bp_user_fullname() { echo bp_get_displayed_user_fullname(); } 990 1347 991 1348 1349 /** 1350 * Output the logged-in user's display name. 1351 */ 992 1352 function bp_loggedin_user_fullname() { 993 1353 echo bp_get_loggedin_user_fullname(); 994 1354 } 1355 /** 1356 * Get the logged-in user's display name. 1357 * 1358 * @return string 1359 */ 995 1360 function bp_get_loggedin_user_fullname() { 996 1361 global $bp; … … 998 1363 } 999 1364 1365 /** 1366 * Output the username of the displayed user. 1367 */ 1000 1368 function bp_displayed_user_username() { 1001 1369 echo bp_get_displayed_user_username(); 1002 1370 } 1371 /** 1372 * Get the username of the displayed user. 1373 * 1374 * @return string 1375 */ 1003 1376 function bp_get_displayed_user_username() { 1004 1377 global $bp; … … 1013 1386 } 1014 1387 1388 /** 1389 * Output the username of the logged-in user. 1390 */ 1015 1391 function bp_loggedin_user_username() { 1016 1392 echo bp_get_loggedin_user_username(); 1017 1393 } 1394 /** 1395 * Get the username of the logged-in user. 1396 * 1397 * @return string 1398 */ 1018 1399 function bp_get_loggedin_user_username() { 1019 1400 global $bp; … … 1033 1414 * Do we have a working custom sign up page? 1034 1415 * 1035 * @since BuddyPress (1.5 )1036 * 1037 * @uses bp_get_signup_slug() To make sure there is a slug assigned to the page 1038 * @uses bp_locate_template() To make sure a template exists to provide output 1039 * @return bool ean True if page and template exist, false if not1416 * @since BuddyPress (1.5.0) 1417 * 1418 * @uses bp_get_signup_slug() To make sure there is a slug assigned to the page. 1419 * @uses bp_locate_template() To make sure a template exists to provide output. 1420 * @return bool True if page and template exist, false if not. 1040 1421 */ 1041 1422 function bp_has_custom_signup_page() { … … 1049 1430 1050 1431 /** 1051 * Echoes the URL to the signup page1432 * Output the URL to the signup page. 1052 1433 */ 1053 1434 function bp_signup_page() { … … 1055 1436 } 1056 1437 /** 1057 * Returns the URL to the signup page1438 * Get the URL to the signup page. 1058 1439 * 1059 1440 * @return string … … 1072 1453 * Do we have a working custom activation page? 1073 1454 * 1074 * @since BuddyPress (1.5 )1075 * 1076 * @uses bp_get_activate_slug() To make sure there is a slug assigned to the page 1077 * @uses bp_locate_template() To make sure a template exists to provide output 1078 * @return boolean True if page and template exist, false if not 1455 * @since BuddyPress (1.5.0) 1456 * 1457 * @uses bp_get_activate_slug() To make sure there is a slug assigned to the page. 1458 * @uses bp_locate_template() To make sure a template exists to provide output. 1459 * @return boolean True if page and template exist, false if not. 1079 1460 */ 1080 1461 function bp_has_custom_activation_page() { … … 1087 1468 } 1088 1469 1470 /** 1471 * Output the URL of the actvitation page. 1472 */ 1089 1473 function bp_activation_page() { 1090 1474 echo bp_get_activation_page(); 1091 1475 } 1476 /** 1477 * Get the URL of the activation page. 1478 * 1479 * @return string 1480 */ 1092 1481 function bp_get_activation_page() { 1093 1482 if ( bp_has_custom_activation_page() ) { … … 1100 1489 } 1101 1490 1491 /** 1492 * Output the username submitted during signup. 1493 */ 1102 1494 function bp_signup_username_value() { 1103 1495 echo bp_get_signup_username_value(); 1104 1496 } 1497 /** 1498 * Get the username submitted during signup. 1499 * 1500 * @todo This should be properly escaped. 1501 * 1502 * @return string 1503 */ 1105 1504 function bp_get_signup_username_value() { 1106 1505 $value = ''; … … 1111 1510 } 1112 1511 1512 /** 1513 * Output the user email address submitted during signup. 1514 */ 1113 1515 function bp_signup_email_value() { 1114 1516 echo bp_get_signup_email_value(); 1115 1517 } 1518 /** 1519 * Get the email address submitted during signup. 1520 * 1521 * @todo This should be properly escaped. 1522 * 1523 * @return string 1524 */ 1116 1525 function bp_get_signup_email_value() { 1117 1526 $value = ''; … … 1122 1531 } 1123 1532 1533 /** 1534 * Output the 'signup_with_blog' value submitted during signup. 1535 */ 1124 1536 function bp_signup_with_blog_value() { 1125 1537 echo bp_get_signup_with_blog_value(); 1126 1538 } 1539 /** 1540 * Get the 'signup_with_blog' value submitted during signup. 1541 * 1542 * @return string 1543 */ 1127 1544 function bp_get_signup_with_blog_value() { 1128 1545 $value = ''; … … 1133 1550 } 1134 1551 1552 /** 1553 * Output the 'signup_blog_url' value submitted at signup. 1554 */ 1135 1555 function bp_signup_blog_url_value() { 1136 1556 echo bp_get_signup_blog_url_value(); 1137 1557 } 1558 /** 1559 * Get the 'signup_blog_url' value submitted at signup. 1560 * 1561 * @todo Should be properly escaped. 1562 * 1563 * @return string 1564 */ 1138 1565 function bp_get_signup_blog_url_value() { 1139 1566 $value = ''; … … 1144 1571 } 1145 1572 1573 /** 1574 * Output the 'signup_blog_titl' value submitted at signup. 1575 */ 1146 1576 function bp_signup_blog_title_value() { 1147 1577 echo bp_get_signup_blog_title_value(); 1148 1578 } 1579 /** 1580 * Get the 'signup_blog_title' value submitted at signup. 1581 * 1582 * @todo Should be properly escaped. 1583 * 1584 * @return string 1585 */ 1149 1586 function bp_get_signup_blog_title_value() { 1150 1587 $value = ''; … … 1155 1592 } 1156 1593 1594 /** 1595 * Output the 'signup_blog_privacy' value submitted at signup. 1596 */ 1157 1597 function bp_signup_blog_privacy_value() { 1158 1598 echo bp_get_signup_blog_privacy_value(); 1159 1599 } 1600 /** 1601 * Get the 'signup_blog_privacy' value submitted at signup. 1602 * 1603 * @todo Should be properly escaped. 1604 * 1605 * @return string 1606 */ 1160 1607 function bp_get_signup_blog_privacy_value() { 1161 1608 $value = ''; … … 1166 1613 } 1167 1614 1615 /** 1616 * Output the avatar dir used during signup. 1617 */ 1168 1618 function bp_signup_avatar_dir_value() { 1169 1619 echo bp_get_signup_avatar_dir_value(); 1170 1620 } 1621 /** 1622 * Get the avatar dir used during signup. 1623 * 1624 * @return string 1625 */ 1171 1626 function bp_get_signup_avatar_dir_value() { 1172 1627 global $bp; … … 1187 1642 } 1188 1643 1644 /** 1645 * Output the current signup step. 1646 */ 1189 1647 function bp_current_signup_step() { 1190 1648 echo bp_get_current_signup_step(); 1191 1649 } 1650 /** 1651 * Get the current signup step. 1652 * 1653 * @return string 1654 */ 1192 1655 function bp_get_current_signup_step() { 1193 1656 global $bp; … … 1196 1659 } 1197 1660 1661 /** 1662 * Output the user avatar during signup. 1663 * 1664 * @see bp_get_signup_avatar() for description of arguments. 1665 * 1666 * @param array $args See {@link bp_get_signup_avatar(}. 1667 */ 1198 1668 function bp_signup_avatar( $args = '' ) { 1199 1669 echo bp_get_signup_avatar( $args ); 1200 1670 } 1671 /** 1672 * Get the user avatar during signup. 1673 * 1674 * @see bp_core_fetch_avatar() for description of arguments. 1675 * 1676 * @param array $args { 1677 * Array of optional arguments. 1678 * @type int $size Height/weight in pixels. Default: value of 1679 * bp_core_avatar_full_width(). 1680 * @type string $class CSS class. Default: 'avatar'. 1681 * @type string $alt HTML 'alt' attribute. Default: 'Your Avatar'. 1682 * } 1683 * @return string 1684 */ 1201 1685 function bp_get_signup_avatar( $args = '' ) { 1202 1686 $bp = buddypress(); … … 1244 1728 } 1245 1729 1730 /** 1731 * Output whether signup is allowed. 1732 * 1733 * @todo Remove this function. Echoing a bool is pointless. 1734 */ 1246 1735 function bp_signup_allowed() { 1247 1736 echo bp_get_signup_allowed(); 1248 1737 } 1738 /** 1739 * Is user signup allowed? 1740 * 1741 * @return bool 1742 */ 1249 1743 function bp_get_signup_allowed() { 1250 1744 global $bp; … … 1267 1761 1268 1762 /** 1269 * Hook member activity feed to <head> 1270 * 1271 * @since BuddyPress (1.5 )1763 * Hook member activity feed to <head>. 1764 * 1765 * @since BuddyPress (1.5.0) 1272 1766 */ 1273 1767 function bp_members_activity_feed() { … … 1281 1775 add_action( 'bp_head', 'bp_members_activity_feed' ); 1282 1776 1283 1777 /** 1778 * Output a link to a members component subpage. 1779 * 1780 * @see bp_get_members_component_link() for description of parameters. 1781 * 1782 * @param string $component See {@bp_get_members_component_link()}. 1783 * @param string $action See {@bp_get_members_component_link()}. 1784 * @param string $query_args See {@bp_get_members_component_link()}. 1785 * @param string $nonce See {@bp_get_members_component_link()}. 1786 */ 1284 1787 function bp_members_component_link( $component, $action = '', $query_args = '', $nonce = false ) { 1285 1788 echo bp_get_members_component_link( $component, $action, $query_args, $nonce ); 1286 1789 } 1790 /** 1791 * Generate a link to a members component subpage. 1792 * 1793 * @param string $component ID of the component (eg 'friends'). 1794 * @param string $action Optional. 'action' slug (eg 'invites'). 1795 * @param array $query_args Optional. Array of URL params to add to the 1796 * URL. See {@link add_query_arg()} for format. 1797 * @param array $nonce Optional. If provided, the URL will be passed 1798 * through wp_nonce_url() with $nonce as the action string. 1799 * @return string 1800 */ 1287 1801 function bp_get_members_component_link( $component, $action = '', $query_args = '', $nonce = false ) { 1288 1802 global $bp;
Note: See TracChangeset
for help on using the changeset viewer.