Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/01/2015 04:18:13 AM (10 years ago)
Author:
tw2113
Message:

First pass of documentation cleanup for the XProfile Component.

See #6406.

File:
1 edited

Legend:

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

    r10140 r10163  
    1212
    1313/**
    14  * Maps XProfile caps to built in WordPress caps
     14 * Maps XProfile caps to built in WordPress caps.
    1515 *
    1616 * @since 1.6.0
    1717 *
    18  * @param array $caps Capabilities for meta capability
    19  * @param string $cap Capability name
    20  * @param int $user_id User id
    21  * @param mixed $args Arguments
    22  * @uses get_post() To get the post
    23  * @uses get_post_type_object() To get the post type object
    24  * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and
    25  *                        args
    26  * @return array Actual capabilities for meta capability
     18 * @param array  $caps    Capabilities for meta capability.
     19 * @param string $cap     Capability name.
     20 * @param int    $user_id User id.
     21 * @param mixed  $args    Arguments.
     22 *
     23 * @uses get_post() To get the post.
     24 * @uses get_post_type_object() To get the post type object.
     25 * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and args.
     26 *
     27 * @return array Actual capabilities for meta capability.
    2728 */
    2829function bp_xprofile_map_meta_caps( $caps, $cap, $user_id, $args ) {
    2930    switch ( $cap ) {
    3031        case 'bp_xprofile_change_field_visibility' :
    31             $caps = array( 'exist' ); // Must allow for logged-out users during registration
     32            $caps = array( 'exist' ); // Must allow for logged-out users during registration.
    3233
    33             // You may pass args manually: $field_id, $profile_user_id
     34            // You may pass args manually: $field_id, $profile_user_id.
    3435            $field_id        = isset( $args[0] ) ? (int)$args[0] : bp_get_the_profile_field_id();
    3536            $profile_user_id = isset( $args[1] ) ? (int)$args[1] : bp_displayed_user_id();
    3637
    37             // Visibility on the fullname field is not editable
     38            // Visibility on the fullname field is not editable.
    3839            if ( 1 == $field_id ) {
    3940                $caps[] = 'do_not_allow';
     
    4748            }
    4849
    49             // Friends don't let friends edit each other's visibility
     50            // Friends don't let friends edit each other's visibility.
    5051            if ( $profile_user_id != bp_displayed_user_id() && !bp_current_user_can( 'bp_moderate' ) ) {
    5152                $caps[] = 'do_not_allow';
Note: See TracChangeset for help on using the changeset viewer.