<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[34880] trunk: Revert [34875] due to unintentional breaking change</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/34880">34880</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/34880","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorbin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-10-06 20:57:35 +0000 (Tue, 06 Oct 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Revert <a href="https://core.trac.wordpress.org/changeset/34875">[34875]</a> due to unintentional breaking change
WordPress.org was taken down due to as Otto42 describes:
The previous version of this function added the query piece for the meta key = blog_id.capabilities, regardless of whether or not a role was requested. This limits the users returned to those with some defined role on this particular multisite instance.
See <a href="https://core.trac.wordpress.org/ticket/22212">#22212</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpuserqueryphp">trunk/src/wp-includes/class-wp-user-query.php</a></li>
<li><a href="#trunktestsphpunittestsuserqueryphp">trunk/tests/phpunit/tests/user/query.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpuserqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-user-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-user-query.php 2015-10-06 19:55:56 UTC (rev 34879)
+++ trunk/src/wp-includes/class-wp-user-query.php 2015-10-06 20:57:35 UTC (rev 34880)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,8 +88,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $defaults = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'blog_id' => $GLOBALS['blog_id'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'role' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'role__in' => array(),
- 'role__not_in' => array(),
</del><span class="cx" style="display: block; padding: 0 10px"> 'meta_key' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'meta_value' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'meta_compare' => '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,8 +117,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0 Added 'meta_value_num' support for `$orderby` parameter. Added multi-dimensional array syntax
</span><span class="cx" style="display: block; padding: 0 10px"> * for `$orderby` parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.3.0 Added 'has_published_posts' parameter.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 4.4.0 Added 'paged', 'role__in', and 'role__not_in' parameters. 'role' parameter was updated to
- * permit an array or comma-separated list of values.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 4.4.0 Added 'paged' parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -130,13 +127,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. Array or string of Query parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type int $blog_id The site ID. Default is the global blog id.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string|array $role An array or a comma-separated list of role names that users must match
- * to be included in results. Note that this is an inclusive list: users
- * must match *each* role. Default empty.
- * @type array $role__in An array of role names. Matched users must have at least one of these
- * roles. Default empty array.
- * @type array $role__not_in An array of role names to exclude. Users matching one or more of these
- * roles will not be included in results. Default empty array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $role Role name. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string $meta_key User meta key. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $meta_value User meta value. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $meta_compare Comparison operator to test the `$meta_value`. Accepts '=', '!=',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,76 +259,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->meta_query = new WP_Meta_Query();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->meta_query->parse_query_vars( $qv );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $roles = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $role = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $qv['role'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_array( $qv['role'] ) ) {
- $roles = $qv['role'];
- } elseif ( is_string( $qv['role'] ) && ! empty( $qv['role'] ) ) {
- $roles = array_map( 'trim', explode( ',', $qv['role'] ) );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $role = trim( $qv['role'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $role__in = array();
- if ( isset( $qv['role__in'] ) ) {
- $role__in = (array) $qv['role__in'];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $blog_id && ( $role || is_multisite() ) ) {
+ $cap_meta_query = array();
+ $cap_meta_query['key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $role__not_in = array();
- if ( isset( $qv['role__not_in'] ) ) {
- $role__not_in = (array) $qv['role__not_in'];
- }
-
- if ( $blog_id && ( ! empty( $roles ) || ! empty( $role__in ) || ! empty( $role__not_in ) || is_multisite() ) ) {
- $role_queries = array( 'relation' => 'AND' );
- $roles_clauses = array( 'relation' => 'AND' );
- if ( ! empty( $roles ) ) {
- foreach ( $roles as $role ) {
- $roles_clauses[] = array(
- 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
- 'value' => $role,
- 'compare' => 'LIKE',
- );
- }
-
- // Sanity check: this clause may already have been added to the meta_query.
- if ( empty( $this->meta_query->clauses ) || ! in_array( $roles_clauses, $this->meta_query_clauses, true ) ) {
- $role_queries[] = $roles_clauses;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $role ) {
+ $cap_meta_query['value'] = '"' . $role . '"';
+ $cap_meta_query['compare'] = 'like';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $role__in_clauses = array( 'relation' => 'OR' );
- if ( ! empty( $role__in ) ) {
- foreach ( $role__in as $role ) {
- $role__in_clauses[] = array(
- 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
- 'value' => $role,
- 'compare' => 'LIKE',
- );
- }
-
- $role_queries[] = $role__in_clauses;
- }
-
- $role__not_in_clauses = array( 'relation' => 'AND' );
- if ( ! empty( $role__not_in ) ) {
- foreach ( $role__not_in as $role ) {
- $role__not_in_clauses[] = array(
- 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
- 'value' => $role,
- 'compare' => 'NOT LIKE',
- );
- }
-
- $role_queries[] = $role__not_in_clauses;
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $this->meta_query->queries ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->meta_query->queries = $role_queries;
- } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->meta_query->queries = array( $cap_meta_query );
+ } elseif ( ! in_array( $cap_meta_query, $this->meta_query->queries, true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Append the cap query to the original queries and reparse the query.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->meta_query->queries = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'relation' => 'AND',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( $this->meta_query->queries, $role_queries ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( $this->meta_query->queries, $cap_meta_query ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsuserqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/user/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/user/query.php 2015-10-06 19:55:56 UTC (rev 34879)
+++ trunk/tests/phpunit/tests/user/query.php 2015-10-06 20:57:35 UTC (rev 34880)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -896,336 +896,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $q->query_vars[ $k ] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 22212
- */
- public function test_get_single_role_by_user_query() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create( array(
- 'role' => 'contributor',
- ) );
-
- $wp_user_search = new WP_User_Query( array( 'role' => 'subscriber' ) );
- $users = $wp_user_search->get_results();
-
- $this->assertEquals( 2, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_multiple_roles_by_user_query() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $this->factory->user->create( array(
- 'role' => 'contributor',
- ) );
-
- $wp_user_search = new WP_User_Query( array( 'role__in' => array( 'subscriber', 'editor' ) ) );
- $users = $wp_user_search->get_results();
- $this->assertEquals( 5, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_single_role_by_string() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create( array(
- 'role' => 'contributor',
- ) );
-
- $users = get_users( array(
- 'role' => 'subscriber',
- ) );
-
- $this->assertEquals( 2, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_single_role_by_array() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create( array(
- 'role' => 'contributor',
- ) );
-
- $users = get_users( array(
- 'role' => array( 'subscriber' ),
- ) );
-
- $this->assertEquals( 2, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_multiple_roles_should_only_match_users_who_have_each_role() {
- $subscribers = $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $this->factory->user->create_many( 2, array(
- 'role' => 'administrator',
- ) );
-
- $users = new WP_User_Query( array( 'role' => array( 'subscriber', 'editor' ) ) );
- $users = $users->get_results();
-
- $this->assertEmpty( $users );
-
- foreach ( $subscribers as $subscriber ) {
- $subscriber = get_user_by( 'ID', $subscriber );
- $subscriber->add_role( 'editor' );
- }
-
- $users = new WP_User_Query( array( 'role' => array( 'subscriber', 'editor' ) ) );
- $users = $users->get_results();
-
- $this->assertEquals( 2, count( $users ) );
-
- foreach ( $users as $user ) {
- $this->assertInstanceOf( 'WP_User', $user );
- }
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_multiple_roles_or() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $this->factory->user->create_many( 2, array(
- 'role' => 'administrator',
- ) );
-
- $this->factory->user->create_many( 1, array(
- 'role' => 'contributor',
- ) );
-
- $users = new WP_User_Query( array( 'role__in' => array( 'subscriber', 'editor', 'administrator' ) ) );
- $users = $users->get_results();
-
- // +1 for the default user created during installation.
- $this->assertEquals( 8, count( $users ) );
- foreach ( $users as $user ) {
- $this->assertInstanceOf( 'WP_User', $user );
- }
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_multiple_roles_by_comma_separated_list() {
- $subscribers = $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $users = get_users( array(
- 'role' => 'subscriber, editor',
- ) );
-
- $this->assertEmpty( $users );
-
- foreach ( $subscribers as $subscriber ) {
- $subscriber = get_user_by( 'ID', $subscriber );
- $subscriber->add_role( 'editor' );
- }
-
- $users = get_users( array(
- 'role' => 'subscriber, editor',
- ) );
-
- $this->assertEquals( 2, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_get_multiple_roles_with_meta() {
- // Create administrator user + meta
- $administrator_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
- update_user_meta( $administrator_id, 'mk1', 1 );
- update_user_meta( $administrator_id, 'mk2', 1 );
-
- // Create editor user + meta
- $editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
- update_user_meta( $editor_id, 'mk1', 1 );
- update_user_meta( $editor_id, 'mk2', 2 );
-
- // Create subscriber user + meta
- $subscriber_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
- update_user_meta( $subscriber_id, 'mk1', 1 );
- update_user_meta( $subscriber_id, 'mk2', 1 );
-
- // Create contributor user + meta
- $contributor_id = $this->factory->user->create( array( 'role' => 'contributor' ) );
- update_user_meta( $contributor_id, 'mk1', 1 );
- update_user_meta( $contributor_id, 'mk2', 2 );
-
- // Fetch users
- $users = get_users( array(
- 'role__in' => array( 'administrator', 'editor', 'subscriber' ),
- 'meta_query' => array(
- 'relation' => 'AND',
- array(
- 'key' => 'mk1',
- 'value' => '1',
- 'compare' => "=",
- 'type' => 'numeric',
- ),
- array(
- 'key' => 'mk2',
- 'value' => '2',
- 'compare' => "=",
- 'type' => 'numeric',
- ),
- ),
- ) );
-
- // Check results
- $this->assertEquals( 1, count( $users ) );
- $this->assertSame( $editor_id, (int) $users[0]->ID );
- }
-
- /**
- * @ticket 22212
- */
- public function test_role_exclusion() {
- $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $users = get_users( array(
- 'role__not_in' => 'subscriber',
- ) );
-
- // +1 for the default user created during installation.
- $this->assertEquals( 4, count( $users ) );
-
- $users = get_users( array(
- 'role__not_in' => 'editor',
- ) );
-
- // +1 for the default user created during installation.
- $this->assertEquals( 3, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_role__in_role__not_in_combined() {
- $subscribers = $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- foreach ( $subscribers as $subscriber ) {
- $subscriber = get_user_by( 'ID', $subscriber );
- $subscriber->add_role( 'editor' );
- }
-
- $users = get_users( array(
- 'role__in' => 'editor',
- ) );
-
- $this->assertEquals( 5, count( $users ) );
-
- $users = get_users( array(
- 'role__in' => 'editor',
- 'role__not_in' => 'subscriber',
- ) );
-
- $this->assertEquals( 3, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_role__not_in_role_combined() {
- $subscribers = $this->factory->user->create_many( 2, array(
- 'role' => 'subscriber',
- ) );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $subscriber = get_user_by( 'ID', $subscribers[0] );
- $subscriber->add_role( 'editor' );
-
- $users = get_users( array(
- 'role' => 'subscriber',
- 'role__not_in' => array( 'editor' ),
- ) );
-
- $this->assertEquals( 1, count( $users ) );
- }
-
- /**
- * @ticket 22212
- */
- public function test_role__not_in_user_without_role() {
- $user_without_rule = $this->factory->user->get_object_by_id( $this->factory->user->create( array(
- 'role' => 'subscriber',
- ) ) );
-
- $user_without_rule->remove_role( 'subscriber' );
-
- $this->factory->user->create_many( 3, array(
- 'role' => 'editor',
- ) );
-
- $users = get_users( array(
- 'role__not_in' => 'subscriber',
- ) );
-
- // +1 for the default user created during installation.
- $this->assertEquals( 5, count( $users ) );
-
- $users = get_users( array(
- 'role__not_in' => 'editor',
- ) );
-
- // +1 for the default user created during installation.
- $this->assertEquals( 2, count( $users ) );
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>