Skip to:
Content

BuddyPress.org

Changeset 10434


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

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

See #6406.

Location:
trunk/src/bp-xprofile
Files:
19 edited

Legend:

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

    r10417 r10434  
    8585    do_action( 'bp_xprofile_settings_before_save' );
    8686
    87     /** Save ******************************************************************/
     87    /* Save ******************************************************************/
    8888
    8989    // Only save if there are field ID's being posted.
     
    117117    }
    118118
    119     /** Other *****************************************************************/
     119    /* Other *****************************************************************/
    120120
    121121    /**
  • trunk/src/bp-xprofile/bp-xprofile-activity.php

    r10417 r10434  
    5858 * @param string $action   Static activity action.
    5959 * @param object $activity Activity object.
    60  *
    6160 * @return string
    6261 */
     
    8887 * @param string $action   Static activity action.
    8988 * @param object $activity Activity object.
    90  *
    9189 * @return string
    9290 */
     
    120118 *
    121119 * @param array|string $args String containing all variables used after bp_parse_args() call.
    122  *
    123120 * @return array
    124121 */
     
    157154 *
    158155 * @param array|string $args Containing all variables used after bp_parse_args() call.
    159  *
    160156 * @return bool
    161157 */
     
    183179 * @param string $key Key.
    184180 * @param string $value Value.
    185  *
    186181 * @return bool True if success, false on failure.
    187182 */
     
    215210 *
    216211 * @param int $user_id The user id the avatar was set for.
    217  *
    218212 * @return bool
    219213 */
     
    257251 * @param array $old_values Pre-save xprofile field values and visibility levels.
    258252 * @param array $new_values Post-save xprofile field values and visibility levels.
    259  *
    260253 * @return bool True on success, false on failure.
    261254 */
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r10418 r10434  
    480480/**
    481481 * Handles the ajax reordering of fields within a group.
     482 *
     483 * @since 1.0.0
    482484 */
    483485function xprofile_ajax_reorder_fields() {
     
    502504/**
    503505 * Handles the reordering of field groups.
     506 *
     507 * @since 1.5.0
    504508 */
    505509function xprofile_ajax_reorder_field_groups() {
     
    522526/**
    523527 * Handles the WYSIWYG display of each profile field on the edit screen.
     528 *
     529 * @since 1.5.0
    524530 *
    525531 * @param object $admin_field Admin field.
  • trunk/src/bp-xprofile/bp-xprofile-cache.php

    r10417 r10434  
    2121 * @param int   $user_id   User ID to check.
    2222 * @param array $field_ids XProfile field IDs.
    23  *
    2423 * @return array
    2524 */
     
    5453 * @param array $object_ids Multi-dimensional array of object_ids, keyed by
    5554 *                          object type ('group', 'field', 'data').
    56  *
    5755 * @return bool
    5856 */
     
    290288 * @since 2.4.0
    291289 *
    292  * @param int|BP_XProfile_Field A field ID or a field object.
    293  * @param bool False on failure.
     290 * @param int|BP_XProfile_Field $field A field ID or a field object.
     291 * @return bool False on failure.
    294292 */
    295293function bp_xprofile_clear_field_cache( $field ) {
  • trunk/src/bp-xprofile/bp-xprofile-caps.php

    r10163 r10434  
    2424 * @uses get_post_type_object() To get the post type object.
    2525 * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and args.
    26  *
    2726 * @return array Actual capabilities for meta capability.
    2827 */
  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r10418 r10434  
    268268 * @param mixed $field_value Field value.
    269269 * @param int   $field_id    Field type.
    270  *
    271270 * @return string
    272271 */
     
    284283 * @param BP_XProfile_Field      $field          Field object.
    285284 * @param BP_XProfile_Field_Type $field_type_obj Field type object.
    286  *
    287285 * @return mixed
    288286 */
     
    310308function bp_xprofile_escape_field_data( $value, $field_type, $field_id ) {
    311309    if ( bp_xprofile_is_richtext_enabled_for_field( $field_id ) ) {
    312         // xprofile_filter_kses() expects a BP_XProfile_ProfileData object.
     310        // The xprofile_filter_kses() expects a BP_XProfile_ProfileData object.
    313311        $data_obj = null;
    314312        if ( bp_is_user() ) {
     
    337335 * @param string $field_value Profile field data value.
    338336 * @param string $field_type  Profile field type.
    339  *
    340337 * @return string
    341338 */
     
    484481 *
    485482 * @param string $q SQL query.
    486  *
    487483 * @return string
    488484 */
  • 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 */
  • trunk/src/bp-xprofile/bp-xprofile-loader.php

    r10417 r10434  
    1414defined( 'ABSPATH' ) || exit;
    1515
     16/**
     17 * Creates our XProfile component.
     18 */
    1619class BP_XProfile_Component extends BP_Component {
    1720
     
    5457     * Include files.
    5558     *
    56      * @param array $includes
     59     * @param array $includes Array of files to include.
    5760     */
    5861    public function includes( $includes = array() ) {
     
    237240        }
    238241
    239         // Change Cover image
     242        // Change Cover image.
    240243        if ( bp_displayed_user_use_cover_image_header() ) {
    241244            $sub_nav[] = array(
     
    410413     *
    411414     * @param array $wp_admin_nav The settings adminbar nav array.
    412      *
    413415     * @return array
    414416     */
     
    430432}
    431433
     434/**
     435 * Bootstrap the XProfile component.
     436 */
    432437function bp_setup_xprofile() {
    433438    $bp = buddypress();
  • trunk/src/bp-xprofile/bp-xprofile-notifications.php

    r10417 r10434  
    2222 * @param string $format            'string' for BuddyBar-compatible notifications; 'array'
    2323 *                                  for WP Toolbar. Default: 'string'.
    24  *
    2524 * @return string
    2625 */
     
    3332             * Notifications must have a 'component_name' of 'xprofile' to be routed
    3433             * to this function.
    35              *
    3634             *
    3735             * @since 2.4.0
  • trunk/src/bp-xprofile/bp-xprofile-screens.php

    r10417 r10434  
    303303function xprofile_screen_change_cover_image() {
    304304
    305     // Bail if not the correct screen
     305    // Bail if not the correct screen.
    306306    if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) {
    307307        return false;
  • trunk/src/bp-xprofile/bp-xprofile-settings.php

    r10417 r10434  
    1717 *
    1818 * @param array|string $args Array of args for the settings fields.
    19  *
    2019 * @return array
    2120 */
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r10417 r10434  
    165165    }
    166166
     167    /**
     168     * Whether or not the loop has field groups.
     169     *
     170     * @return bool
     171     */
    167172    public function has_groups() {
    168173        if ( ! empty( $this->group_count ) ) {
     
    173178    }
    174179
     180    /**
     181     * Increments to the next group of fields.
     182     *
     183     * @return object
     184     */
    175185    public function next_group() {
    176186        $this->current_group++;
     
    196206    }
    197207
     208    /**
     209     * Rewinds to the start of the groups list.
     210     */
    198211    public function rewind_groups() {
    199212        $this->current_group = -1;
     
    203216    }
    204217
     218    /**
     219     * Kicks off the profile groups.
     220     *
     221     * @return bool
     222     */
    205223    public function profile_groups() {
    206224        if ( $this->current_group + 1 < $this->group_count ) {
     
    223241    }
    224242
     243    /**
     244     * Sets up the profile group.
     245     */
    225246    public function the_profile_group() {
    226247        global $group;
     
    243264    /** Fields ****************************************************************/
    244265
     266    /**
     267     * Increments to the next field.
     268     *
     269     * @return int
     270     */
    245271    public function next_field() {
    246272        $this->current_field++;
     
    251277    }
    252278
     279    /**
     280     * Rewinds to the start of the fields.
     281     */
    253282    public function rewind_fields() {
    254283        $this->current_field = -1;
     
    258287    }
    259288
     289    /**
     290     * Whether or not the loop has fields.
     291     *
     292     * @return bool
     293     */
    260294    public function has_fields() {
    261295        $has_data = false;
     
    272306    }
    273307
     308    /**
     309     * Kick off the profile fields.
     310     *
     311     * @return bool
     312     */
    274313    public function profile_fields() {
    275314        if ( $this->current_field + 1 < $this->field_count ) {
     
    283322    }
    284323
     324    /**
     325     * Set up the profile fields.
     326     */
    285327    public function the_profile_field() {
    286328        global $field;
     
    369411}
    370412
     413/**
     414 * Start off the profile groups.
     415 *
     416 * @return mixed
     417 */
    371418function bp_profile_groups() {
    372419    global $profile_template;
     
    374421}
    375422
     423/**
     424 * Set up the profile groups.
     425 *
     426 * @return mixed
     427 */
    376428function bp_the_profile_group() {
    377429    global $profile_template;
     
    379431}
    380432
     433/**
     434 * Whether or not the group has fields to display.
     435 *
     436 * @return mixed
     437 */
    381438function bp_profile_group_has_fields() {
    382439    global $profile_template;
     
    384441}
    385442
     443/**
     444 * Output the class attribute for a field.
     445 *
     446 * @param string|bool $class Extra classes to append to class attribute.
     447 */
    386448function bp_field_css_class( $class = false ) {
    387449    echo bp_get_field_css_class( $class );
    388450}
     451
     452    /**
     453     * Return the class attribute for a field.
     454     *
     455     * @param string|bool $class Extra classes to append to class attribute.
     456     * @return string
     457     */
    389458    function bp_get_field_css_class( $class = false ) {
    390459        global $profile_template;
     
    437506    }
    438507
     508/**
     509 * Whether or not the XProfile field has data to display.
     510 *
     511 * @return mixed
     512 */
    439513function bp_field_has_data() {
    440514    global $profile_template;
     
    442516}
    443517
     518/**
     519 * Whether or not the XProfile field has public data to display.
     520 *
     521 * @return bool
     522 */
    444523function bp_field_has_public_data() {
    445524    global $profile_template;
     
    452531}
    453532
     533/**
     534 * Output the XProfile group ID.
     535 */
    454536function bp_the_profile_group_id() {
    455537    echo bp_get_the_profile_group_id();
    456538}
     539
     540    /**
     541     * Return the XProfile group ID.
     542     *
     543     * @return mixed|void
     544     */
    457545    function bp_get_the_profile_group_id() {
    458546        global $group;
    459547
    460548        /**
    461          * Filters the profile group ID.
     549         * Filters the XProfile group ID.
    462550         *
    463551         * @since 1.1.0
     
    468556    }
    469557
     558/**
     559 * Output the XProfile group name.
     560 */
    470561function bp_the_profile_group_name() {
    471562    echo bp_get_the_profile_group_name();
    472563}
     564
     565    /**
     566     * Return the XProfile group name.
     567     *
     568     * @return mixed|void
     569     */
    473570    function bp_get_the_profile_group_name() {
    474571        global $group;
    475572
    476573        /**
    477          * Filters the profile group name.
     574         * Filters the XProfile group name.
    478575         *
    479576         * @since 1.0.0
     
    484581    }
    485582
     583/**
     584 * Output the XProfile group slug.
     585 */
    486586function bp_the_profile_group_slug() {
    487587    echo bp_get_the_profile_group_slug();
    488588}
     589
     590    /**
     591     * Return the XProfile group slug.
     592     *
     593     * @return mixed|void
     594     */
    489595    function bp_get_the_profile_group_slug() {
    490596        global $group;
    491597
    492598        /**
    493          * Filters the profile group slug.
     599         * Filters the XProfile group slug.
    494600         *
    495601         * @since 1.1.0
     
    500606    }
    501607
     608/**
     609 * Output the XProfile group description.
     610 */
    502611function bp_the_profile_group_description() {
    503612    echo bp_get_the_profile_group_description();
    504613}
     614
     615    /**
     616     * Return the XProfile group description.
     617     *
     618     * @return mixed|void
     619     */
    505620    function bp_get_the_profile_group_description() {
    506621        global $group;
    507622
    508623        /**
    509          * Filters the profile group description.
     624         * Filters the XProfile group description.
    510625         *
    511626         * @since 1.0.0
     
    516631    }
    517632
     633/**
     634 * Output the XProfile group edit form action.
     635 */
    518636function bp_the_profile_group_edit_form_action() {
    519637    echo bp_get_the_profile_group_edit_form_action();
    520638}
     639
     640    /**
     641     * Return the XProfile group edit form action.
     642     *
     643     * @return mixed|void
     644     */
    521645    function bp_get_the_profile_group_edit_form_action() {
    522646        global $group;
     
    526650
    527651        /**
    528          * Filters the action for the profile group edit form.
     652         * Filters the action for the XProfile group edit form.
    529653         *
    530654         * @since 1.1.0
     
    536660    }
    537661
     662/**
     663 * Output the XProfile group field IDs.
     664 */
    538665function bp_the_profile_group_field_ids() {
    539666    echo bp_get_the_profile_group_field_ids();
    540667}
     668
     669    /**
     670     * Return the XProfile group field IDs.
     671     *
     672     * @return string
     673     */
    541674    function bp_get_the_profile_group_field_ids() {
    542675        global $group;
     
    590723    }
    591724
     725/**
     726 * Return the XProfile fields.
     727 *
     728 * @return mixed
     729 */
    592730function bp_profile_fields() {
    593731    global $profile_template;
     
    595733}
    596734
     735/**
     736 * Sets up the XProfile field.
     737 *
     738 * @return mixed
     739 */
    597740function bp_the_profile_field() {
    598741    global $profile_template;
     
    600743}
    601744
     745/**
     746 * Output the XProfile field ID.
     747 */
    602748function bp_the_profile_field_id() {
    603749    echo bp_get_the_profile_field_id();
    604750}
     751
     752    /**
     753     * Return the XProfile field ID.
     754     * @return mixed|void
     755     */
    605756    function bp_get_the_profile_field_id() {
    606757        global $field;
    607758
    608759        /**
    609          * Filters the profile field ID.
     760         * Filters the XProfile field ID.
    610761         *
    611762         * @since 1.1.0
     
    616767    }
    617768
     769/**
     770 * Outputs the XProfile field name.
     771 */
    618772function bp_the_profile_field_name() {
    619773    echo bp_get_the_profile_field_name();
    620774}
     775
     776    /**
     777     * Returns the XProfile field name.
     778     *
     779     * @return mixed|void
     780     */
    621781    function bp_get_the_profile_field_name() {
    622782        global $field;
    623783
    624784        /**
    625          * Filters the profile field name.
     785         * Filters the XProfile field name.
    626786         *
    627787         * @since 1.0.0
     
    632792    }
    633793
     794/**
     795 * Outputs the XProfile field value.
     796 */
    634797function bp_the_profile_field_value() {
    635798    echo bp_get_the_profile_field_value();
    636799}
     800
     801    /**
     802     * Returns the XProfile field value.
     803     *
     804     * @return mixed|void
     805     */
    637806    function bp_get_the_profile_field_value() {
    638807        global $field;
     
    641810
    642811        /**
    643          * Filters the profile field value.
     812         * Filters the XProfile field value.
    644813         *
    645814         * @since 1.0.0
     
    652821    }
    653822
     823/**
     824 * Outputs the XProfile field edit value.
     825 */
    654826function bp_the_profile_field_edit_value() {
    655827    echo bp_get_the_profile_field_edit_value();
    656828}
     829
     830    /**
     831     * Returns the XProfile field edit value.
     832     *
     833     * @return mixed|void
     834     */
    657835    function bp_get_the_profile_field_edit_value() {
    658836        global $field;
     
    681859
    682860        /**
    683          * Filters the profile field edit value.
     861         * Filters the XProfile field edit value.
    684862         *
    685863         * @since 1.1.0
     
    692870    }
    693871
     872/**
     873 * Outputs the XProfile field type.
     874 */
    694875function bp_the_profile_field_type() {
    695876    echo bp_get_the_profile_field_type();
    696877}
     878
     879    /**
     880     * Returns the XProfile field type.
     881     *
     882     * @return mixed|void
     883     */
    697884    function bp_get_the_profile_field_type() {
    698885        global $field;
    699886
    700887        /**
    701          * Filters the profile field type.
     888         * Filters the XProfile field type.
    702889         *
    703890         * @since 1.1.0
     
    708895    }
    709896
     897/**
     898 * Outputs the XProfile field description.
     899 */
    710900function bp_the_profile_field_description() {
    711901    echo bp_get_the_profile_field_description();
    712902}
     903
     904    /**
     905     * Returns the XProfile field description.
     906     *
     907     * @return mixed|void
     908     */
    713909    function bp_get_the_profile_field_description() {
    714910        global $field;
    715911
    716912        /**
    717          * Filters the profile field description.
     913         * Filters the XProfile field description.
    718914         *
    719915         * @since 1.1.0
     
    724920    }
    725921
     922/**
     923 * Outputs the XProfile field input name.
     924 */
    726925function bp_the_profile_field_input_name() {
    727926    echo bp_get_the_profile_field_input_name();
    728927}
     928
     929    /**
     930     * Retursn the XProfile field input name.
     931     *
     932     * @return mixed|void
     933     */
    729934    function bp_get_the_profile_field_input_name() {
    730935        global $field;
     
    8211026    }
    8221027
     1028/**
     1029 * Render whether or not a profile field is required.
     1030 */
    8231031function bp_the_profile_field_is_required() {
    8241032    echo bp_get_the_profile_field_is_required();
    8251033}
     1034
     1035    /**
     1036     * Return whether or not a profile field is required.
     1037     * @return mixed|void
     1038     */
    8261039    function bp_get_the_profile_field_is_required() {
    8271040        global $field;
     
    8441057
    8451058/**
    846  * Echo the visibility level of this field.
     1059 * Output the visibility level of this field.
    8471060 */
    8481061function bp_the_profile_field_visibility_level() {
    8491062    echo bp_get_the_profile_field_visibility_level();
    8501063}
     1064
    8511065    /**
    8521066     * Return the visibility level of this field.
     1067     *
     1068     * @return mixed|void
    8531069     */
    8541070    function bp_get_the_profile_field_visibility_level() {
     
    8801096    echo bp_get_the_profile_field_visibility_level_label();
    8811097}
     1098
    8821099    /**
    8831100     * Return the visibility level label of this field.
     1101     *
     1102     * @return mixed|void
    8841103     */
    8851104    function bp_get_the_profile_field_visibility_level_label() {
     
    9071126    }
    9081127
    909 
     1128/**
     1129 * Return unserialized profile field data.
     1130 *
     1131 * @param string $value Content to maybe unserialize.
     1132 * @return mixed|string
     1133 */
    9101134function bp_unserialize_profile_field( $value ) {
    9111135    if ( is_serialized($value) ) {
     
    9181142}
    9191143
     1144/**
     1145 * Output XProfile field data.
     1146 *
     1147 * @param string|array $args Array of arguments for field data.
     1148 */
    9201149function bp_profile_field_data( $args = '' ) {
    9211150    echo bp_get_profile_field_data( $args );
    9221151}
     1152
     1153    /**
     1154     * Return XProfile field data.
     1155     *
     1156     * @param string|array $args Array of arguments for field data.
     1157     * @return mixed|void
     1158     */
    9231159    function bp_get_profile_field_data( $args = '' ) {
    9241160
     
    10541290}
    10551291
     1292/**
     1293 * Output the XProfile group name.
     1294 *
     1295 * @param bool $deprecated Deprecated boolean parameter.
     1296 * @return mixed|void
     1297 */
    10561298function bp_profile_group_name( $deprecated = true ) {
    10571299    if ( !$deprecated ) {
     
    10611303    }
    10621304}
     1305
     1306    /**
     1307     * Return the XProfile group name.
     1308     *
     1309     * @return mixed|void
     1310     */
    10631311    function bp_get_profile_group_name() {
    10641312
     
    10821330    }
    10831331
     1332/**
     1333 * Render a formatted string displaying when a profile was last updated.
     1334 */
    10841335function bp_profile_last_updated() {
    10851336
     
    10921343    }
    10931344}
     1345
     1346    /**
     1347     * Return a formatted string displaying when a profile was last updated.
     1348     *
     1349     * @return bool|mixed|void
     1350     */
    10941351    function bp_get_profile_last_updated() {
    10951352
     
    11111368    }
    11121369
     1370/**
     1371 * Display the current profile group ID.
     1372 */
    11131373function bp_current_profile_group_id() {
    11141374    echo bp_get_current_profile_group_id();
    11151375}
     1376
     1377    /**
     1378     * Return the current profile group ID.
     1379     *
     1380     * @since 1.1.0
     1381     *
     1382     * @return mixed|void
     1383     */
    11161384    function bp_get_current_profile_group_id() {
    11171385        $profile_group_id = bp_action_variable( 1 );
     
    11321400    }
    11331401
     1402/**
     1403 * Render an avatar delete link.
     1404 */
    11341405function bp_avatar_delete_link() {
    11351406    echo bp_get_avatar_delete_link();
    11361407}
     1408
     1409    /**
     1410     * Return an avatar delete link.
     1411     *
     1412     * @since 1.1.0
     1413     * @return mixed|void
     1414     */
    11371415    function bp_get_avatar_delete_link() {
    11381416
     
    11471425    }
    11481426
     1427/**
     1428 * Render an edit profile button.
     1429 */
    11491430function bp_edit_profile_button() {
    11501431    bp_button( array(
     
    11741455     *
    11751456     * @param array|string $args Args for the radio buttons.
    1176      *
    11771457     * @return string $retval
    11781458     */
     
    12531533     *
    12541534     * @param array|string $args Args for the select list.
    1255      *
    12561535     * @return string $retval
    12571536     */
     
    13201599 *
    13211600 * @since 2.4.0
    1322  *
    1323  * @return string HTML for the required label.
    13241601 */
    13251602function bp_the_profile_field_required_label() {
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

    r10418 r10434  
    311311     *                                date string (Y-m-d H:i:s).
    312312     * @param string|int $field_id    Optional. ID of the field.
    313      *
    314313     * @return string Date formatted by bp_format_time().
    315314     */
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-url.php

    r10418 r10434  
    4747     * Must be used inside the {@link bp_profile_fields()} template loop.
    4848     *
     49     * @since 2.1.0
     50     *
    4951     * @param array $raw_properties Optional key/value array of
    5052     *                              {@link http://dev.w3.org/html5/markup/input.number.html permitted attributes}
    5153     *                              that you want to add.
    52      *
    53      * @since 2.1.0
    5454     */
    5555    public function edit_field_html( array $raw_properties = array() ) {
     
    8787     * Must be used inside the {@link bp_profile_fields()} template loop.
    8888     *
     89     * @since 2.1.0
     90     *
    8991     * @param array $raw_properties Optional key/value array of permitted
    9092     *                              attributes that you want to add.
    91      * @since 2.1.0
    9293     */
    9394    public function admin_field_html( array $raw_properties = array() ) {
     
    131132     * @param string     $submitted_value Raw value submitted by the user.
    132133     * @param string|int $field_id        Optional. ID of the field.
    133      *
    134134     * @return string
    135135     */
     
    161161     * @param string     $field_value The URL value, as saved in the database.
    162162     * @param string|int $field_id    Optional. ID of the field.
    163      *
    164163     * @return string URL converted to a link.
    165164     */
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type.php

    r10418 r10434  
    2020    /**
    2121     * Validation regex rules for field type.
     22     *
    2223     * @since 2.0.0
    2324     * @var array Field type validation regexes.
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php

    r10418 r10434  
    1111defined( 'ABSPATH' ) || exit;
    1212
     13/**
     14 * Class to help set up XProfile fields.
     15 */
    1316class BP_XProfile_Field {
    1417
     
    1720     *
    1821     * @since 1.0.0
    19      *
    2022     * @var int ID of field.
    2123     */
     
    2628     *
    2729     * @since 1.0.0
    28      *
    2930     * @var int Field group ID for field.
    3031     */
     
    3536     *
    3637     * @since 1.0.0
    37      *
    3838     * @var int Parent ID of field.
    3939     */
     
    4444     *
    4545     * @since 1.0.0
    46      *
    4746     * @var string Field type.
    4847     */
     
    5352     *
    5453     * @since 1.0.0
    55      *
    5654     * @var string Field name.
    5755     */
     
    6260     *
    6361     * @since 1.0.0
    64      *
    6562     * @var string Field description.
    6663     */
     
    7168     *
    7269     * @since 1.0.0
    73      *
    7470     * @var bool Is field required to be filled out?
    7571     */
     
    8076     *
    8177     * @since 1.0.0
    82      *
    8378     * @var int Can field be deleted?
    8479     */
     
    8984     *
    9085     * @since 1.0.0
    91      *
    9286     * @var int Field position.
    9387     */
     
    9892     *
    9993     * @since 1.0.0
    100      *
    10194     * @var int Option order.
    10295     */
     
    107100     *
    108101     * @since 1.0.0
    109      *
    110102     * @var string Order child fields by.
    111103     */
     
    116108     *
    117109     * @since 1.0.0
    118      *
    119110     * @var bool Is this the default option for this field?
    120111     */
     
    126117     * @since 1.9.0
    127118     * @since 2.4.0 Property marked protected. Now accessible by magic method or by `get_default_visibility()`.
    128      *
    129119     * @var string Default field data visibility.
    130120     */
     
    136126     * @since 2.3.0
    137127     * @since 2.4.0 Property marked protected. Now accessible by magic method or by `get_allow_custom_visibility()`.
    138      *
    139128     * @var string Members are allowed/disallowed to modify data visibility.
    140129     */
     
    145134     *
    146135     * @since 2.0.0
    147      *
    148136     * @var BP_XProfile_Field_Type Field type object used for validation.
    149137     */
     
    154142     *
    155143     * @since 2.0.0
    156      *
    157144     * @var BP_XProfile_ProfileData Field data for user ID.
    158145     */
     
    323310     *
    324311     * @param boolean $delete_data Whether or not to delete data.
    325      *
    326312     * @return boolean
    327313     */
     
    486472            do_action_ref_array( 'xprofile_field_after_save', array( $this ) );
    487473
    488             // Recreate type_obj in case someone changed $this->type via a filter
     474            // Recreate type_obj in case someone changed $this->type via a filter.
    489475            $this->type_obj            = bp_xprofile_create_field_type( $this->type );
    490476            $this->type_obj->field_obj = $this;
     
    502488     *
    503489     * @param int $user_id ID of the user to get field data for.
    504      *
    505490     * @return object
    506491     */
     
    517502     *
    518503     * @param bool $for_editing Whether or not the field is for editing.
    519      *
    520504     * @return array
    521505     */
     
    639623     * @param bool  $append       Whether to append to existing member types. If false, all existing member type
    640624     *                            associations will be deleted before adding your `$member_types`. Default false.
    641      *
    642625     * @return array Member types for the current field, after being saved.
    643626     */
     
    810793    }
    811794
    812     /** Static Methods ********************************************************/
    813 
     795    /* Static Methods ********************************************************/
     796
     797    /**
     798     * Get the type for provided field ID.
     799     *
     800     * @param int $field_id Field ID to get type of.
     801     * @return bool|null|string
     802     */
    814803    public static function get_type( $field_id = 0 ) {
    815804        global $wpdb;
     
    840829     *
    841830     * @param int $group_id ID of the field group to delete fields from.
    842      *
    843831     * @return boolean
    844832     */
     
    871859     *
    872860     * @param string $field_name Name of the field to query the ID for.
    873      *
    874861     * @return boolean
    875862     */
     
    898885     * @param int|null $position       Field position to update.
    899886     * @param int|null $field_group_id ID of the field group.
    900      *
    901887     * @return boolean
    902888     */
     
    934920     * @param string|array $member_types Member type or array of member types. Use 'any' to return unrestricted
    935921     *                                   fields (those available for anyone, regardless of member type).
    936      *
    937922     * @return array Multi-dimensional array, with field IDs as top-level keys, and arrays of member types
    938923     *               associated with each field as values.
     
    10751060
    10761061    /**
    1077      * This function populates the items for radio buttons checkboxes and drop
    1078      * down boxes.
     1062     * Populates the items for radio buttons, checkboxes, and dropdown boxes.
    10791063     */
    10801064    public function render_admin_form_children() {
     
    14891473     *
    14901474     * @param int $field_id ID of field to check.
    1491      *
    14921475     * @return bool
    14931476     */
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php

    r10417 r10434  
    1111defined( 'ABSPATH' ) || exit;
    1212
     13/**
     14 * Class to help set up XProfile Groups.
     15 */
    1316class BP_XProfile_Group {
    1417
     
    1720     *
    1821     * @since 1.1.0
    19      *
    2022     * @var int ID of field group
    2123     */
     
    2628     *
    2729     * @since 1.1.0
    28      *
    2930     * @var string Name of field group
    3031     */
     
    3536     *
    3637     * @since 1.1.0
    37      *
    3838     * @var string Description of field group
    3939     */
     
    4444     *
    4545     * @since 1.1.0
    46      *
    4746     * @var bool Can this group be deleted?
    4847     */
     
    5352     *
    5453     * @since 1.1.0
    55      *
    5654     * @var int Group order relative to other groups
    5755     */
     
    6260     *
    6361     * @since 1.1.0
    64      *
    6562     * @var array Fields of group
    6663     */
     
    180177     * @since 1.1.0
    181178     *
    182      * @global object  $wpdb
     179     * @global object $wpdb
     180     *
    183181     * @return boolean
    184182     */
     
    235233     * Populates the BP_XProfile_Group object with profile field groups, fields,
    236234     * and field data
    237      *
    238      * @package BuddyPress XProfile
    239235     *
    240236     * @global object $wpdb WordPress DB access object.
     
    501497     *
    502498     * @param array $group_ids Array of IDs.
    503      *
    504499     * @return array
    505500     */
     
    592587     *
    593588     * @global $wpdb $wpdb
     589     *
    594590     * @param  int $field_group_id ID of the group the field belongs to.
    595591     * @param  int $position       Field group position.
    596      *
    597592     * @return boolean
    598593     */
     
    619614     * @param int   $user_id The profile owner's user_id.
    620615     * @param array $fields  The database results returned by the get() query.
    621      *
    622616     * @return array $fields The database results, with field_visibility added
    623617     */
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    r10417 r10434  
    1111defined( 'ABSPATH' ) || exit;
    1212
     13/**
     14 * Class for XProfile Profile Data setup.
     15 *
     16 * @since 1.6.0
     17 */
    1318class BP_XProfile_ProfileData {
     19
     20    /**
     21     * XProfile ID.
     22     *
     23     * @var int $id
     24     */
    1425    public $id;
     26
     27    /**
     28     * User ID.
     29     *
     30     * @var int $user_id
     31     */
    1532    public $user_id;
     33
     34    /**
     35     * XProfile field ID.
     36     *
     37     * @var int $field_id
     38     */
    1639    public $field_id;
     40
     41    /**
     42     * XProfile field value.
     43     *
     44     * @var string $value
     45     */
    1746    public $value;
     47
     48    /**
     49     * XProfile field last updated time.
     50     *
     51     * @var string $last_updated
     52     */
    1853    public $last_updated;
    1954
     55    /**
     56     * BP_XProfile_ProfileData constructor.
     57     *
     58     * @param null $field_id Field ID to instantiate.
     59     * @param null $user_id  User ID to instantiate for.
     60     */
    2061    public function __construct( $field_id = null, $user_id = null ) {
    2162        if ( !empty( $field_id ) ) {
     
    2465    }
    2566
     67    /**
     68     * Populates the XProfile profile data.
     69     *
     70     * @param int $field_id Field ID to populate.
     71     * @param int $user_id  User ID to populate for.
     72     */
    2673    public function populate( $field_id, $user_id ) {
    2774        global $wpdb;
     
    111158    }
    112159
     160    /**
     161     * Save the data for the XProfile field.
     162     *
     163     * @return bool
     164     */
    113165    public function save() {
    114166        global $wpdb;
     
    208260     * @param int   $user_id   ID of user whose data is being queried.
    209261     * @param array $field_ids Array of field IDs to query for.
    210      *
    211262     * @return array
    212263     */
     
    274325     *
    275326     * @param int $user_id ID of the user.
    276      *
    277327     * @return array
    278328     */
     
    321371     * @param int $field_id Field ID being queried for.
    322372     * @param int $user_id  User ID associated with field.
    323      *
    324373     * @return int $fielddata_id
    325374     */
     
    352401     * @param int            $field_id ID of the field.
    353402     * @param int|array|null $user_ids ID or IDs of user(s).
    354      *
    355403     * @return string|array Single value if a single user is queried,
    356404     *                      otherwise an array of results.
     
    428476    }
    429477
     478    /**
     479     * Get profile field values by field name and user ID.
     480     *
     481     * @param array|string $fields  Field(s) to get.
     482     * @param int|null     $user_id User ID to get field data for.
     483     * @return array|bool
     484     */
    430485    public static function get_value_byfieldname( $fields, $user_id = null ) {
    431486        global $wpdb;
     
    483538    }
    484539
     540    /**
     541     * Delete field.
     542     *
     543     * @param int $field_id ID of the field to delete.
     544     * @return bool
     545     */
    485546    public static function delete_for_field( $field_id ) {
    486547        global $wpdb;
     
    495556    }
    496557
     558    /**
     559     * Get time for last XProfile field data update by user.
     560     *
     561     * @param int $user_id User ID to get time for.
     562     * @return null|string
     563     */
    497564    public static function get_last_updated( $user_id ) {
    498565        global $wpdb;
     
    505572    }
    506573
     574    /**
     575     * Delete all data for provided user ID.
     576     *
     577     * @param int $user_id User ID to remove data for.
     578     * @return false|int
     579     */
    507580    public static function delete_data_for_user( $user_id ) {
    508581        global $wpdb;
     
    513586    }
    514587
     588    /**
     589     * Get random field type by user ID.
     590     *
     591     * @param int    $user_id          User ID to query for.
     592     * @param string $exclude_fullname SQL portion used to exclude by field ID.
     593     * @return array|null|object
     594     */
    515595    public static function get_random( $user_id, $exclude_fullname ) {
    516596        global $wpdb;
     
    523603    }
    524604
     605    /**
     606     * Get fullname for provided user ID.
     607     *
     608     * @param int $user_id ID of the user to query.
     609     * @return mixed
     610     */
    525611    public static function get_fullname( $user_id = 0 ) {
    526612
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-query.php

    r10417 r10434  
    2424     *
    2525     * @since 2.2.0
    26      * @var    array
     26     * @var array
    2727     */
    2828    public $queries = array();
     
    3232     *
    3333     * @since 2.2.0
    34      * @var    string
     34     * @var string
    3535     */
    3636    public $primary_table;
     
    4040     *
    4141     * @since 2.2.0
    42      * @var    string
     42     * @var string
    4343     */
    4444    public $primary_id_column;
     
    4848     *
    4949     * @since 2.2.0
    50      * @var    array
     50     * @var array
    5151     */
    5252    protected $table_aliases = array();
     
    9393     *
    9494     * @param array $queries Array of query clauses.
    95      *
    9695     * @return array Sanitized array of query clauses.
    9796     */
     
    160159     *
    161160     * @param  array $query XProfile query arguments.
    162      *
    163161     * @return bool  Whether the query clause is a first-order clause.
    164162     */
     
    173171     *
    174172     * @param string $type MySQL type to cast `value`.
    175      *
    176173     * @return string MySQL type.
    177174     */
     
    231228     * @since 2.2.0
    232229     *
    233      * @param  array $query Query to parse.
     230     * @param  array $query Query to parse. Passed by reference.
    234231     * @param  int   $depth Optional. Number of tree levels deep we currently are. Used to calculate indentation.
    235      *
    236232     * @return array {
    237233     *     Array containing JOIN and WHERE SQL clauses to append to a single query array.
     
    314310     * @param string $primary_table     Database table where the object being filtered is stored (eg wp_users).
    315311     * @param string $primary_id_column ID column for the filtered object in $primary_table.
    316      *
    317312     * @return array {
    318313     *     Array containing JOIN and WHERE SQL clauses to append to the main query.
     
    349344     * @param array $clause       Query clause.
    350345     * @param array $parent_query Parent query array.
    351      *
    352346     * @return array {
    353347     *     Array containing JOIN and WHERE SQL clauses to append to a first-order query.
     
    499493     * @param array $clause       Query clause.
    500494     * @param array $parent_query Parent query of $clause.
    501      *
    502495     * @return string|bool Table alias if found, otherwise false.
    503496     */
Note: See TracChangeset for help on using the changeset viewer.