Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/05/2016 10:26:25 PM (10 years ago)
Author:
slaffik
Message:

Make bp_core_can_edit_settings() filterable.

New filter bp_core_can_edit_settings is introduced, with the context of a $status.

Props modemlooper.
Fixes #7280.

File:
1 edited

Legend:

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

    r11256 r11269  
    14751475 */
    14761476function bp_core_can_edit_settings() {
     1477        $status = false;
     1478
    14771479        if ( bp_is_my_profile() ) {
    1478                 return true;
    1479         }
    1480 
    1481         if ( is_super_admin( bp_displayed_user_id() ) && ! is_super_admin() ) {
    1482                 return false;
    1483         }
    1484 
    1485         if ( bp_current_user_can( 'bp_moderate' ) || current_user_can( 'edit_users' ) ) {
    1486                 return true;
    1487         }
    1488 
    1489         return false;
     1480                $status = true;
     1481        } elseif ( is_super_admin( bp_displayed_user_id() ) && ! is_super_admin() ) {
     1482                $status = false;
     1483        } elseif ( bp_current_user_can( 'bp_moderate' ) || current_user_can( 'edit_users' ) ) {
     1484                $status = true;
     1485        }
     1486
     1487        /**
     1488         * Filters the status of whether the logged-in user can edit settings for the displayed user or not.
     1489         *
     1490         * @since 2.8.0
     1491         *
     1492         * @param bool True if editing is allowed, otherwise false.
     1493         */
     1494        return apply_filters( 'bp_core_can_edit_settings', $status );
    14901495}
    14911496
Note: See TracChangeset for help on using the changeset viewer.