Changeset 11320
- Timestamp:
- 12/22/2016 08:28:41 PM (10 years ago)
- File:
-
- 1 edited
-
branches/2.2/src/bp-core/bp-core-avatars.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/src/bp-core/bp-core-avatars.php
r9381 r11320 751 751 return false; 752 752 753 $original_file = bp_core_avatar_upload_path() . $original_file; 753 if ( 'user' === $object ) { 754 $avatar_dir = 'avatars'; 755 } else { 756 $avatar_dir = sanitize_key( $args['object'] ) . '-avatars'; 757 } 758 759 $original_file = sprintf( '%s/%s/%s/%s', bp_core_avatar_upload_path(), $avatar_dir, $item_id, basename( $original_file ) ); 754 760 755 761 if ( !file_exists( $original_file ) ) 756 762 return false; 763 764 // Capability check. 765 $has_cap = bp_current_user_can( 'bp_moderate' ); 766 if ( ! $has_cap ) { 767 if ( 'user' === $object ) { 768 $has_cap = bp_loggedin_user_id() === (int) $args['item_id']; 769 } elseif ( 'group' === $object && bp_is_active( 'groups' ) ) { 770 if ( bp_is_group_create() ) { 771 $has_cap = (bool) groups_is_user_creator( bp_loggedin_user_id(), $args['item_id'] ); 772 } else { 773 $has_cap = (bool) groups_is_user_admin( bp_loggedin_user_id(), $args['item_id'] ); 774 } 775 } 776 } 777 778 if ( ! $has_cap ) { 779 return false; 780 } 757 781 758 782 if ( empty( $item_id ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)