Changeset 10434 for trunk/src/bp-xprofile/bp-xprofile-functions.php
- Timestamp:
- 01/03/2016 06:14:41 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-functions.php
r10418 r10434 27 27 * @param array $args See {@link BP_XProfile_Group::get()} for description of 28 28 * arguments. 29 *30 29 * @return array $groups 31 30 */ … … 51 50 * 52 51 * @param array|string $args Array of arguments for field group insertion. 53 *54 52 * @return boolean 55 53 */ … … 84 82 * 85 83 * @param int $field_group_id Field group ID to fetch. 86 *87 84 * @return boolean|BP_XProfile_Group 88 85 */ … … 107 104 * 108 105 * @param int $field_group_id Field group ID to delete. 109 *110 106 * @return boolean 111 107 */ … … 131 127 * @param int $field_group_id Field group ID to update. 132 128 * @param int $position Field group position to update to. 133 *134 129 * @return boolean 135 130 */ … … 178 173 * 179 174 * @param string $type Type of profile field to create. See {@link bp_xprofile_get_field_types()} for default core values. 180 *181 175 * @return object $value If field type unknown, returns BP_XProfile_Field_Type_Textarea. 182 176 * Otherwise returns an instance of the relevant child class of BP_XProfile_Field_Type. … … 300 294 } 301 295 296 /** 297 * Delete a profile field object. 298 * 299 * @param int|object $field_id ID of the field or object representing field data. 300 * @return bool Whether or not the field was deleted. 301 */ 302 302 function xprofile_delete_field( $field_id ) { 303 303 $field = new BP_XProfile_Field( $field_id ); … … 320 320 * @param string $multi_format How should array data be returned? 'comma' if you want a 321 321 * comma-separated string; 'array' if you want an array. 322 *323 322 * @return mixed The profile field data. 324 323 */ … … 371 370 return $data; 372 371 } 372 373 373 /** 374 374 * A simple function to set profile data for a specific field for a specific user. … … 380 380 * @param mixed $value The value for the field you want to set for the user. 381 381 * @param bool $is_required Whether or not the field is required. 382 *383 382 * @return bool True on success, false on failure. 384 383 */ … … 459 458 * @param int $user_id The ID of the user to whom the data belongs. 460 459 * @param string $visibility_level What the visibity setting should be. 461 *462 460 * @return bool True on success 463 461 */ … … 492 490 * @param int $field_id The ID of the xprofile field. 493 491 * @param int $user_id The ID of the user to whom the data belongs. 494 *495 492 * @return string 496 493 */ … … 520 517 } 521 518 519 /** 520 * Delete XProfile field data. 521 * 522 * @param string $field Field to delete. 523 * @param int $user_id User ID to delete field from. 524 * @return bool Whether or not the field was deleted. 525 */ 522 526 function xprofile_delete_field_data( $field = '', $user_id = 0 ) { 523 527 … … 541 545 } 542 546 547 /** 548 * Check if field is a required field. 549 * 550 * @param int $field_id ID of the field to check for. 551 * @return bool Whether or not field is required. 552 */ 543 553 function xprofile_check_is_required_field( $field_id ) { 544 554 $field = new BP_XProfile_Field( $field_id ); … … 574 584 * @param bool $exclude_fullname Optional; whether or not to exclude the full name field as random data. 575 585 * Defaults to true. 576 *577 586 * @return string|bool The fetched random data for the user, or false if no data or no match. 578 587 */ … … 605 614 * @param string $field_type The type of field: datebox, selectbox, textbox etc. 606 615 * @param string $field_value The actual value. 607 *608 616 * @return string|bool The formatted value, or false if value is empty. 609 617 */ … … 624 632 } 625 633 634 /** 635 * Update the field position for a provided field. 636 * 637 * @param int $field_id ID of the field to update. 638 * @param int $position Position to update the field to. 639 * @param int $field_group_id Group ID for group the field is in. 640 * @return bool 641 */ 626 642 function xprofile_update_field_position( $field_id, $position, $field_group_id ) { 627 643 return BP_XProfile_Field::update_position( $field_id, $position, $field_group_id ); … … 666 682 * @param string $directory The root directory name. Optional. 667 683 * @param int $user_id The user ID. Optional. 668 *669 684 * @return array Array containing the path, URL, and other helpful settings. 670 685 */ … … 711 726 * @param array $sql Clauses in the user_id SQL query. 712 727 * @param BP_User_Query $query User query object. 713 *714 728 * @return array 715 729 */ … … 756 770 * 757 771 * @param int $user_id ID of the user to sync. 758 *759 772 * @return bool 760 773 */ … … 796 809 add_action( 'bp_core_signup_user', 'xprofile_sync_wp_profile' ); 797 810 add_action( 'bp_core_activated_user', 'xprofile_sync_wp_profile' ); 798 799 811 800 812 /** … … 848 860 * delete matching metadata entries for the specified object. 849 861 * Default: false. 850 *851 862 * @return bool True on success, false on failure. 852 863 */ … … 898 909 * specified meta_key. This parameter has no effect if meta_key is not 899 910 * specified. Default: true. 900 *901 911 * @return mixed Meta value if found. False on failure. 902 912 */ … … 926 936 * metadata entries with the specified value. 927 937 * Otherwise update all entries. 928 *929 938 * @return bool|int Returns false on failure. On successful update of existing 930 939 * metadata, returns true. On successful creation of new metadata, … … 954 963 * has a value for the key, no change will be made. 955 964 * Default false. 956 *957 965 * @return int|bool The meta ID on successful update, false on failure. 958 966 */ … … 967 975 } 968 976 977 /** 978 * Updates the fieldgroup metadata. 979 * 980 * @param int $field_group_id Group ID for the group field belongs to. 981 * @param string $meta_key Meta key to update. 982 * @param string $meta_value Meta value to update to. 983 * @return bool|int 984 */ 969 985 function bp_xprofile_update_fieldgroup_meta( $field_group_id, $meta_key, $meta_value ) { 970 986 return bp_xprofile_update_meta( $field_group_id, 'group', $meta_key, $meta_value ); 971 987 } 972 988 989 /** 990 * Updates the field metadata. 991 * 992 * @param int $field_id Field ID to update. 993 * @param string $meta_key Meta key to update. 994 * @param string $meta_value Meta value to update to. 995 * @return bool|int 996 */ 973 997 function bp_xprofile_update_field_meta( $field_id, $meta_key, $meta_value ) { 974 998 return bp_xprofile_update_meta( $field_id, 'field', $meta_key, $meta_value ); 975 999 } 976 1000 1001 /** 1002 * Updates the fielddata metadata. 1003 * 1004 * @param int $field_data_id Field ID to update. 1005 * @param string $meta_key Meta key to update. 1006 * @param string $meta_value Meta value to update to. 1007 * @return bool|int 1008 */ 977 1009 function bp_xprofile_update_fielddata_meta( $field_data_id, $meta_key, $meta_value ) { 978 1010 return bp_xprofile_update_meta( $field_data_id, 'data', $meta_key, $meta_value ); … … 1004 1036 * Return the field name for the Full Name xprofile field. 1005 1037 * 1006 * @package BuddyPress1007 1038 * @since 1.5.0 1008 1039 * … … 1016 1047 * @since 1.5.0 1017 1048 * 1018 * @param string BP_XPROFILE_FULLNAME_FIELD_NAME Full name field constant.1049 * @param string $value BP_XPROFILE_FULLNAME_FIELD_NAME Full name field constant. 1019 1050 */ 1020 1051 return apply_filters( 'bp_xprofile_fullname_field_name', BP_XPROFILE_FULLNAME_FIELD_NAME ); … … 1086 1117 * @param int $displayed_user_id The id of the user the profile fields belong to. 1087 1118 * @param int $current_user_id The id of the user viewing the profile. 1088 *1089 1119 * @return array An array of field ids that should be excluded from the profile query 1090 1120 */ … … 1132 1162 * @param int $displayed_user_id The id of the user the profile fields belong to. 1133 1163 * @param int $current_user_id The id of the user viewing the profile. 1134 *1135 1164 * @return array An array of visibility levels hidden to the current user. 1136 1165 */ … … 1180 1209 * @param array $levels An array of visibility levels ('public', 'friends', 'loggedin', 'adminsonly' etc) to be 1181 1210 * checked against. 1182 *1183 1211 * @return array $field_ids The fields that match the requested visibility levels for the given user. 1184 1212 */
Note: See TracChangeset
for help on using the changeset viewer.