Make WordPress Core


Ignore:
Timestamp:
09/25/2016 05:44:24 PM (8 years ago)
Author:
boonebgorges
Message:

Allow 'role' parameters to be passed to wp_dropdown_users().

wp_dropdown_users() contains a whitelist of function params that are
passed through to get_users(). role, role__in, and role__not_in
have now been added to this whitelist.

Props sillybean.
Fixes #38135.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r38457 r38651  
    965965 * @since 2.3.0
    966966 * @since 4.5.0 Added the 'display_name_with_login' value for 'show'.
     967 * @since 4.7.0 Added the `$role`, `$role__in`, and `$role__not_in` parameters.
    967968 *
    968969 * @param array|string $args {
     
    10051006 *     @type string       $who                     Which type of users to query. Accepts only an empty string or
    10061007 *                                                 'authors'. Default empty.
     1008 *     @type string|array $role                    An array or a comma-separated list of role names that users must
     1009 *                                                 match to be included in results. Note that this is an inclusive
     1010 *                                                 list: users must match *each* role. Default empty.
     1011 *     @type array        $role__in                An array of role names. Matched users must have at least one of
     1012 *                                                 these roles. Default empty array.
     1013 *     @type array        $role__not_in            An array of role names to exclude. Users matching one or more of
     1014 *                                                 these roles will not be included in results. Default empty array.
    10071015 * }
    10081016 * @return string String of HTML content.
     
    10161024        'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '',
    10171025        'blog_id' => get_current_blog_id(), 'who' => '', 'include_selected' => false,
    1018         'option_none_value' => -1
     1026        'option_none_value' => -1,
     1027        'role' => '',
     1028        'role__in' => array(),
     1029        'role__not_in' => array(),
    10191030    );
    10201031
     
    10231034    $r = wp_parse_args( $args, $defaults );
    10241035
    1025     $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
     1036    $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) );
    10261037
    10271038    $fields = array( 'ID', 'user_login' );
Note: See TracChangeset for help on using the changeset viewer.