Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/03/2016 06:14:41 AM (9 years ago)
Author:
tw2113
Message:

More cleanup and new phpdocs for functions or methods in the XProfile component.

See #6406.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r10418 r10434  
    2727 * @param array $args See {@link BP_XProfile_Group::get()} for description of
    2828 *                    arguments.
    29  *
    3029 * @return array $groups
    3130 */
     
    5150 *
    5251 * @param array|string $args Array of arguments for field group insertion.
    53  *
    5452 * @return boolean
    5553 */
     
    8482 *
    8583 * @param int $field_group_id Field group ID to fetch.
    86  *
    8784 * @return boolean|BP_XProfile_Group
    8885 */
     
    107104 *
    108105 * @param int $field_group_id Field group ID to delete.
    109  *
    110106 * @return boolean
    111107 */
     
    131127 * @param int $field_group_id Field group ID to update.
    132128 * @param int $position       Field group position to update to.
    133  *
    134129 * @return boolean
    135130 */
     
    178173 *
    179174 * @param string $type Type of profile field to create. See {@link bp_xprofile_get_field_types()} for default core values.
    180  *
    181175 * @return object $value If field type unknown, returns BP_XProfile_Field_Type_Textarea.
    182176 *                       Otherwise returns an instance of the relevant child class of BP_XProfile_Field_Type.
     
    300294}
    301295
     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 */
    302302function xprofile_delete_field( $field_id ) {
    303303    $field = new BP_XProfile_Field( $field_id );
     
    320320 * @param string $multi_format How should array data be returned? 'comma' if you want a
    321321 *                             comma-separated string; 'array' if you want an array.
    322  *
    323322 * @return mixed The profile field data.
    324323 */
     
    371370    return $data;
    372371}
     372
    373373/**
    374374 * A simple function to set profile data for a specific field for a specific user.
     
    380380 * @param mixed      $value       The value for the field you want to set for the user.
    381381 * @param bool       $is_required Whether or not the field is required.
    382  *
    383382 * @return bool True on success, false on failure.
    384383 */
     
    459458 * @param int    $user_id          The ID of the user to whom the data belongs.
    460459 * @param string $visibility_level What the visibity setting should be.
    461  *
    462460 * @return bool True on success
    463461 */
     
    492490 * @param int $field_id The ID of the xprofile field.
    493491 * @param int $user_id The ID of the user to whom the data belongs.
    494  *
    495492 * @return string
    496493 */
     
    520517}
    521518
     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 */
    522526function xprofile_delete_field_data( $field = '', $user_id = 0 ) {
    523527
     
    541545}
    542546
     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 */
    543553function xprofile_check_is_required_field( $field_id ) {
    544554    $field  = new BP_XProfile_Field( $field_id );
     
    574584 * @param bool $exclude_fullname Optional; whether or not to exclude the full name field as random data.
    575585 *                               Defaults to true.
    576  *
    577586 * @return string|bool The fetched random data for the user, or false if no data or no match.
    578587 */
     
    605614 * @param string $field_type  The type of field: datebox, selectbox, textbox etc.
    606615 * @param string $field_value The actual value.
    607  *
    608616 * @return string|bool The formatted value, or false if value is empty.
    609617 */
     
    624632}
    625633
     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 */
    626642function xprofile_update_field_position( $field_id, $position, $field_group_id ) {
    627643    return BP_XProfile_Field::update_position( $field_id, $position, $field_group_id );
     
    666682 * @param string $directory The root directory name. Optional.
    667683 * @param int    $user_id   The user ID. Optional.
    668  *
    669684 * @return array Array containing the path, URL, and other helpful settings.
    670685 */
     
    711726 * @param array         $sql   Clauses in the user_id SQL query.
    712727 * @param BP_User_Query $query User query object.
    713  *
    714728 * @return array
    715729 */
     
    756770 *
    757771 * @param int $user_id ID of the user to sync.
    758  *
    759772 * @return bool
    760773 */
     
    796809add_action( 'bp_core_signup_user',      'xprofile_sync_wp_profile' );
    797810add_action( 'bp_core_activated_user',   'xprofile_sync_wp_profile' );
    798 
    799811
    800812/**
     
    848860 *                                 delete matching metadata entries for the specified object.
    849861 *                                 Default: false.
    850  *
    851862 * @return bool True on success, false on failure.
    852863 */
     
    898909 *                            specified meta_key. This parameter has no effect if meta_key is not
    899910 *                            specified. Default: true.
    900  *
    901911 * @return mixed Meta value if found. False on failure.
    902912 */
     
    926936 *                            metadata entries with the specified value.
    927937 *                            Otherwise update all entries.
    928  *
    929938 * @return bool|int Returns false on failure. On successful update of existing
    930939 *                  metadata, returns true. On successful creation of new metadata,
     
    954963 *                            has a value for the key, no change will be made.
    955964 *                            Default false.
    956  *
    957965 * @return int|bool The meta ID on successful update, false on failure.
    958966 */
     
    967975}
    968976
     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 */
    969985function bp_xprofile_update_fieldgroup_meta( $field_group_id, $meta_key, $meta_value ) {
    970986    return bp_xprofile_update_meta( $field_group_id, 'group', $meta_key, $meta_value );
    971987}
    972988
     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 */
    973997function bp_xprofile_update_field_meta( $field_id, $meta_key, $meta_value ) {
    974998    return bp_xprofile_update_meta( $field_id, 'field', $meta_key, $meta_value );
    975999}
    9761000
     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 */
    9771009function bp_xprofile_update_fielddata_meta( $field_data_id, $meta_key, $meta_value ) {
    9781010    return bp_xprofile_update_meta( $field_data_id, 'data', $meta_key, $meta_value );
     
    10041036 * Return the field name for the Full Name xprofile field.
    10051037 *
    1006  * @package BuddyPress
    10071038 * @since 1.5.0
    10081039 *
     
    10161047     * @since 1.5.0
    10171048     *
    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.
    10191050     */
    10201051    return apply_filters( 'bp_xprofile_fullname_field_name', BP_XPROFILE_FULLNAME_FIELD_NAME );
     
    10861117 * @param int $displayed_user_id The id of the user the profile fields belong to.
    10871118 * @param int $current_user_id   The id of the user viewing the profile.
    1088  *
    10891119 * @return array An array of field ids that should be excluded from the profile query
    10901120 */
     
    11321162 * @param int $displayed_user_id The id of the user the profile fields belong to.
    11331163 * @param int $current_user_id   The id of the user viewing the profile.
    1134  *
    11351164 * @return array An array of visibility levels hidden to the current user.
    11361165 */
     
    11801209 * @param array $levels  An array of visibility levels ('public', 'friends', 'loggedin', 'adminsonly' etc) to be
    11811210 *                       checked against.
    1182  *
    11831211 * @return array $field_ids The fields that match the requested visibility levels for the given user.
    11841212 */
Note: See TracChangeset for help on using the changeset viewer.