Making WordPress.org


Ignore:
Timestamp:
06/18/2015 06:20:51 PM (9 years ago)
Author:
iandunn
Message:

Trusted Deputy Capabilities: Pull deputy user IDs from global configuration.

This is more consistent with how other user-specific capabilities are defined across the WordPress.org network.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/trusted-deputy-capabilities.php

    r1671 r1673  
    2828 */
    2929function allow_trusted_deputy_capabilities( $required_capabilities, $requested_capability, $user_id, $args ) {
     30    global $trusted_deputies;
    3031    $allow_capability = true;
    3132
    32     if ( ! user_is_trusted_deputy( $user_id ) ) {
     33    if ( ! in_array( $user_id, $trusted_deputies ) ) {
    3334        $allow_capability = false;
    3435    } else if ( in_array( 'do_not_allow', $required_capabilities ) ) {
     
    4546}
    4647add_filter( 'map_meta_cap', __NAMESPACE__ . '\allow_trusted_deputy_capabilities', 10, 4 );
    47 
    48 /**
    49  * Determine if the given user is a trusted Deputy
    50  *
    51  * @param int $user_id
    52  *
    53  * @return bool
    54  */
    55 function user_is_trusted_deputy( $user_id ) {
    56     $trusted_deputies = array(
    57         642041,   // brandondove
    58         385876,   // kcristiano
    59         14470969, // trusteddeputy
    60         499931,   // karenalma
    61     );
    62 
    63     return in_array( $user_id, $trusted_deputies );
    64 }
    6548
    6649/**
Note: See TracChangeset for help on using the changeset viewer.