Changeset 9299
- Timestamp:
- 01/06/2015 03:14:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-template.php
r8971 r9299 57 57 58 58 if( ! empty( $this->group->fields ) ) { 59 60 /** 61 * Filters the group fields for the next_group method. 62 * 63 * @since BuddyPress (1.1.0) 64 * 65 * @param array $fields Array of fields for the group. 66 * @param int $id ID of the field group. 67 */ 59 68 $this->group->fields = apply_filters( 'xprofile_group_fields', $this->group->fields, $this->group->id ); 60 69 $this->field_count = count( $this->group->fields ); … … 75 84 return true; 76 85 } elseif ( $this->current_group + 1 == $this->group_count ) { 86 87 /** 88 * Fires right before the rewinding of profile groups. 89 * 90 * @since BuddyPress (1.1.0) 91 */ 77 92 do_action('xprofile_template_loop_end'); 78 93 // Do some cleaning up after the loop … … 91 106 92 107 if ( 0 == $this->current_group ) // loop has just started 108 109 /** 110 * Fires if the current group is the first in the loop. 111 * 112 * @since BuddyPress (1.1.0) 113 */ 93 114 do_action('xprofile_template_loop_start'); 94 115 } … … 189 210 190 211 $profile_template = new BP_XProfile_Data_Template( $user_id, $profile_group_id, $hide_empty_groups, $fetch_fields, $fetch_field_data, $exclude_groups, $exclude_fields, $hide_empty_fields, $fetch_visibility_level, $update_meta_cache ); 212 213 /** 214 * Filters whether or not a group has a profile to display. 215 * 216 * @since BuddyPress (1.1.0) 217 * 218 * @param bool $has_groups Whether or not there are group profiles to display. 219 * @param string $profile_template Current profile template being used. 220 */ 191 221 return apply_filters( 'bp_has_profile', $profile_template->has_groups(), $profile_template ); 192 222 } … … 238 268 239 269 $css_classes[] = 'field_type_' . sanitize_title( $profile_template->field->type ); 270 271 /** 272 * Filters the field classes to be applied to a field. 273 * 274 * @since BuddyPress (1.1.0) 275 * 276 * @parm array $css_classes Array of classes to be applied to field. Passed by reference. 277 */ 240 278 $css_classes = apply_filters_ref_array( 'bp_field_css_classes', array( &$css_classes ) ); 241 279 280 /** 281 * Filters the class HTML attribute to be used on a field. 282 * 283 * @since BuddyPress (1.1.0) 284 * 285 * @param string $value class HTML attribute with imploded classes. 286 */ 242 287 return apply_filters( 'bp_get_field_css_class', ' class="' . implode( ' ', $css_classes ) . '"' ); 243 288 } … … 262 307 function bp_get_the_profile_group_id() { 263 308 global $group; 309 310 /** 311 * Filters the profile group ID. 312 * 313 * @since BuddyPress (1.1.0) 314 * 315 * @param int $id ID for the profile group. 316 */ 264 317 return apply_filters( 'bp_get_the_profile_group_id', $group->id ); 265 318 } … … 270 323 function bp_get_the_profile_group_name() { 271 324 global $group; 325 326 /** 327 * Filters the profile group name. 328 * 329 * @since BuddyPress (1.0.0) 330 * 331 * @param string $name Name for the profile group. 332 */ 272 333 return apply_filters( 'bp_get_the_profile_group_name', $group->name ); 273 334 } … … 278 339 function bp_get_the_profile_group_slug() { 279 340 global $group; 341 342 /** 343 * Filters the profile group slug. 344 * 345 * @since BuddyPress (1.1.0) 346 * 347 * @param string $value Slug for the profile group. 348 */ 280 349 return apply_filters( 'bp_get_the_profile_group_slug', sanitize_title( $group->name ) ); 281 350 } … … 286 355 function bp_get_the_profile_group_description() { 287 356 global $group; 357 358 /** 359 * Filters the profile group description. 360 * 361 * @since BuddyPress (1.0.0) 362 * 363 * @param string $description Description for the profile group. 364 */ 288 365 return apply_filters( 'bp_get_the_profile_group_description', $group->description ); 289 366 } … … 295 372 global $bp, $group; 296 373 374 /** 375 * Filters the action for the profile group edit form. 376 * 377 * @since BuddyPress (1.1.0) 378 * 379 * @param string $value URL for the action attribute on the 380 * profile group edit form. 381 */ 297 382 return apply_filters( 'bp_get_the_profile_group_edit_form_action', trailingslashit( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . $group->id ) ); 298 383 } … … 342 427 $field_ids = implode( ',', wp_parse_id_list( $field_ids ) ); 343 428 429 /** 430 * Filters the comma-separated list of field IDs. 431 * 432 * @since BuddyPress (2.1.0) 433 * 434 * @param string $field_ids Comma-separated field IDs. 435 */ 344 436 return apply_filters( 'bp_get_the_profile_field_ids', $field_ids ); 345 437 } … … 360 452 function bp_get_the_profile_field_id() { 361 453 global $field; 454 455 /** 456 * Filters the profile field ID. 457 * 458 * @since BuddyPress (1.1.0) 459 * 460 * @param int $id ID for the profile field. 461 */ 362 462 return apply_filters( 'bp_get_the_profile_field_id', $field->id ); 363 463 } … … 369 469 global $field; 370 470 471 /** 472 * Filters the profile field name. 473 * 474 * @since BuddyPress (1.0.0) 475 * 476 * @param string $name Name for the profile field. 477 */ 371 478 return apply_filters( 'bp_get_the_profile_field_name', $field->name ); 372 479 } … … 380 487 $field->data->value = bp_unserialize_profile_field( $field->data->value ); 381 488 489 /** 490 * Filters the profile field value. 491 * 492 * @since BuddyPress (1.0.0) 493 * 494 * @param string $value Value for the profile field. 495 * @param string $type Type for the profile field. 496 * @param int $id ID for the profile field. 497 */ 382 498 return apply_filters( 'bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id ); 383 499 } … … 410 526 $field_value = isset( $field->data->value ) ? bp_unserialize_profile_field( $field->data->value ) : ''; 411 527 528 /** 529 * Filters the profile field edit value. 530 * 531 * @since BuddyPress (1.1.0) 532 * 533 * @param string $field_value Current field edit value. 534 * @param string $type Type for the profile field. 535 * @param int $id ID for the profile field. 536 */ 412 537 return apply_filters( 'bp_get_the_profile_field_edit_value', $field_value, $field->type, $field->id ); 413 538 } … … 419 544 global $field; 420 545 546 /** 547 * Filters the profile field type. 548 * 549 * @since BuddyPress (1.1.0) 550 * 551 * @param string $type Type for the profile field. 552 */ 421 553 return apply_filters( 'bp_the_profile_field_type', $field->type ); 422 554 } … … 428 560 global $field; 429 561 562 /** 563 * Filters the profile field description. 564 * 565 * @since BuddyPress (1.1.0) 566 * 567 * @param string $description Description for the profile field. 568 */ 430 569 return apply_filters( 'bp_get_the_profile_field_description', $field->description ); 431 570 } … … 437 576 global $field; 438 577 578 /** 579 * Filters the profile field input name. 580 * 581 * @since BuddyPress (1.1.0) 582 * 583 * @param string $value Value used for the name attribute on an input. 584 */ 439 585 return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id ); 440 586 } … … 449 595 * do_action( bp_get_the_profile_field_errors_action() ); 450 596 * 451 * @since BuddyPress (1.8 )597 * @since BuddyPress (1.8.0) 452 598 * @return string The _errors action name corresponding to this profile field 453 599 */ … … 464 610 * 465 611 * @package BuddyPress Xprofile 466 * @since BuddyPress (1.1 )612 * @since BuddyPress (1.1.0) 467 613 * 468 614 * @uses bp_get_the_profile_field_options() … … 479 625 * 480 626 * @package BuddyPress Xprofile 481 * @since BuddyPress (1.1 )627 * @since BuddyPress (1.1.0) 482 628 * 483 629 * @uses BP_XProfile_Field::get_children() … … 540 686 $retval = $field->is_required; 541 687 688 /** 689 * Filters whether or not a profile field is required. 690 * 691 * @since BuddyPress (1.1.0) 692 * 693 * @param bool $retval Whether or not the field is required. 694 */ 542 695 return apply_filters( 'bp_get_the_profile_field_is_required', (bool) $retval ); 543 696 } … … 564 717 } 565 718 719 /** 720 * Filters the profile field visibility level. 721 * 722 * @since BuddyPress (1.6.0) 723 * 724 * @param string $retval Field visibility level. 725 */ 566 726 return apply_filters( 'bp_get_the_profile_field_visibility_level', $retval ); 567 727 } … … 590 750 $fields = bp_xprofile_get_visibility_levels(); 591 751 752 /** 753 * Filters the profile field visibility level label. 754 * 755 * @since BuddyPress (1.6.0) 756 * 757 * @param string $retval Field visibility level label. 758 */ 592 759 return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[$level]['label'] ); 593 760 } … … 617 784 extract( $r, EXTR_SKIP ); 618 785 786 /** 787 * Filters the profile field data. 788 * 789 * @since BuddyPress (1.2.0) 790 * 791 * @param mixed $value Profile data for a specific field for the user. 792 */ 619 793 return apply_filters( 'bp_get_profile_field_data', xprofile_get_field_data( $field, $user_id ) ); 620 794 } … … 635 809 } 636 810 811 /** 812 * Filters all profile field groups. 813 * 814 * @since BuddyPress (2.1.0) 815 * 816 * @param array $groups Array of available profile field groups. 817 */ 637 818 return apply_filters( 'bp_profile_get_field_groups', $groups ); 638 819 } … … 647 828 function bp_profile_has_multiple_groups() { 648 829 $has_multiple_groups = count( (array) bp_profile_get_field_groups() ) > 1; 830 831 /** 832 * Filters if there is more than one group of fields for the profile being edited. 833 * 834 * @since BuddyPress (2.1.0) 835 * 836 * @param bool $has_multiple_groups Whether or not there are multiple groups. 837 */ 649 838 return (bool) apply_filters( 'bp_profile_has_multiple_groups', $has_multiple_groups ); 650 839 } … … 676 865 } 677 866 867 /** 868 * Filters the tabs to display for profile field groups. 869 * 870 * @since BuddyPress (1.5.0) 871 * 872 * @param array $tabs Array of tabs to display. 873 * @param array $groups Array of profile groups. 874 * @param string $group_name Name of the current group displayed. 875 */ 678 876 $tabs = apply_filters( 'xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name ); 679 877 foreach ( (array) $tabs as $tab ) 680 878 echo $tab; 681 879 880 /** 881 * Fires at the end of the tab output for switching between profile field groups. 882 * 883 * @since BuddyPress (1.0.0) 884 */ 682 885 do_action( 'xprofile_profile_group_tabs' ); 683 886 } … … 702 905 } 703 906 907 /** 908 * Filters the profile group name. 909 * 910 * @since BuddyPress (1.0.0) 911 * 912 * @param string $name Name of the profile group. 913 */ 704 914 return apply_filters( 'bp_get_profile_group_name', $group->name ); 705 915 } … … 719 929 $last_updated = bp_get_user_meta( bp_displayed_user_id(), 'profile_last_updated', true ); 720 930 721 if ( $last_updated ) 722 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) ); 931 if ( $last_updated ) { 932 933 /** 934 * Filters the formatted string used to display when a profile was last updated. 935 * 936 * @since BuddyPress (1.0.0) 937 * 938 * @param string $value Formatted last updated indicator string. 939 */ 940 return apply_filters( 'bp_get_profile_last_updated', sprintf( __( 'Profile updated %s', 'buddypress' ), bp_core_time_since( strtotime( $last_updated ) ) ) ); 941 } 723 942 724 943 return false; … … 732 951 $profile_group_id = 1; 733 952 734 return apply_filters( 'bp_get_current_profile_group_id', $profile_group_id ); // admin/profile/edit/[group-id] 953 /** 954 * Filters the current profile group ID. 955 * 956 * Possible values are admin/profile/edit/[group-id] 957 * 958 * @since BuddyPress (1.1.0) 959 * 960 * @param string $profile_group_id Current profile group ID. 961 */ 962 return apply_filters( 'bp_get_current_profile_group_id', $profile_group_id ); 735 963 } 736 964 … … 741 969 global $bp; 742 970 971 /** 972 * Filters the link used for deleting an avatar. 973 * 974 * @since BuddyPress (1.1.0) 975 * 976 * @param string $value Nonced URL used for deleting an avatar. 977 */ 743 978 return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . $bp->profile->slug . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) ); 744 979 } … … 818 1053 endif; 819 1054 1055 /** 1056 * Filters the radio buttons for setting visibility. 1057 * 1058 * @since BuddyPress (1.6.0) 1059 * 1060 * @param string $retval HTML output for the visibility radio buttons. 1061 * @param array $r Parsed arguments to be used with display. 1062 * @param array $args Original passed in arguments to be used with display. 1063 */ 820 1064 return apply_filters( 'bp_profile_get_visibility_radio_buttons', $retval, $r, $args ); 821 1065 } … … 881 1125 endif; 882 1126 883 // Output the dropdown list 1127 /** 1128 * Filters the dropdown list for setting visibility. 1129 * 1130 * @since BuddyPress (2.0.0) 1131 * 1132 * @param string $retval HTML output for the visibility dropdown list. 1133 * @param array $r Parsed arguments to be used with display. 1134 * @param array $args Original passed in arguments to be used with display. 1135 */ 884 1136 return apply_filters( 'bp_profile_settings_visibility_select', $retval, $r, $args ); 885 1137 }
Note: See TracChangeset
for help on using the changeset viewer.