Changeset 10163 for trunk/src/bp-xprofile/bp-xprofile-caps.php
- Timestamp:
- 10/01/2015 04:18:13 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-xprofile/bp-xprofile-caps.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-caps.php
r10140 r10163 12 12 13 13 /** 14 * Maps XProfile caps to built in WordPress caps 14 * Maps XProfile caps to built in WordPress caps. 15 15 * 16 16 * @since 1.6.0 17 17 * 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. 27 28 */ 28 29 function bp_xprofile_map_meta_caps( $caps, $cap, $user_id, $args ) { 29 30 switch ( $cap ) { 30 31 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. 32 33 33 // You may pass args manually: $field_id, $profile_user_id 34 // You may pass args manually: $field_id, $profile_user_id. 34 35 $field_id = isset( $args[0] ) ? (int)$args[0] : bp_get_the_profile_field_id(); 35 36 $profile_user_id = isset( $args[1] ) ? (int)$args[1] : bp_displayed_user_id(); 36 37 37 // Visibility on the fullname field is not editable 38 // Visibility on the fullname field is not editable. 38 39 if ( 1 == $field_id ) { 39 40 $caps[] = 'do_not_allow'; … … 47 48 } 48 49 49 // Friends don't let friends edit each other's visibility 50 // Friends don't let friends edit each other's visibility. 50 51 if ( $profile_user_id != bp_displayed_user_id() && !bp_current_user_can( 'bp_moderate' ) ) { 51 52 $caps[] = 'do_not_allow';
Note: See TracChangeset
for help on using the changeset viewer.