The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
22 views

Searching user meta using WP_User_Query

Per the documentation for WP_User_Query, there is an available search parameter. It looks something like this: $users = new WP_User_Query(array( 'search' => 'This is my search' )); You can ...
0
votes
1answer
15 views

WP_User_Query orderby meta_val_num

I know that normal WP_Query's can have an "orderby" parameter of "meta_value_num", but when I try to user "orderby" => "meta_value_num" on a WP_User_Query, it doesn't seem to work. Anyway I can ...
0
votes
0answers
9 views

Second Order Clause Ignored (Users)

So I'm trying to produce a staff list using the contents of the user table. Any user that is listed as a admin, editor or contributor is a member of staff. Here is the query: $sql = "SELECT u.ID, ...
0
votes
1answer
12 views

custom post type 'pre_[cpt]_query' hook

When quering the wordpress users table, is it possible to use 'pre_user_query' to ammend the SQL query before execution against the database. Is there an equivalent hook method for each registered ...
0
votes
1answer
49 views

Display Users from two roles in one list

I asked a question a few days ago (link) about a problem I encountered with WP 4.1 and a WP_User_Query I ran with a custom meta array. My current code worked until I upgraded to 4.1: if( ...
2
votes
1answer
27 views

WP_User_Query users by registered date

I'm trying to get the number of user who registered today. I've tried this: $args = array ( 'role' => 'Subscriber', 'meta_query' => array( array( 'key' => ...
1
vote
1answer
88 views

WP_User_Query with meta_query array relation 'OR'

I just updated to WP 4.1 and a User_Query I was using is now returning 0 instead of the expected results. $pm = array( //'role' => 'program_manager', 'orderby' => 'display_name', ...
0
votes
1answer
74 views

WP_User_Query unexpected output after upgrading toWordpress 4.0.1

I have updated my Wordpress to the new version 4.0.1 and I got some problems. Before I had an old version, the 3.5.1 and everything was ok with my code. Pardon me for my bad english, I try to explain ...
0
votes
0answers
21 views

Include new meta_data in WP_User_Query

I'm trying to add a new meta field to the results that come from Wp_User_Query. Not keen to use get_user_meta() in a loop for each user returned as I believe that it'll make hundreds of database ...
0
votes
1answer
42 views

How do I sort a WP_USER_QUERY by multiple meta fields?

I've got the following WP_USER_QUERY in WordPress: $args = array( 'orderby'=>'meta_value', 'meta_query' => array ( 0 => array( 'key' => 'last_name', ...
2
votes
2answers
164 views

How to order WP_User_Query results to match the order of an array of user IDs?

I'm using WP_User_Query to get a list of users from my database. I'm showing specific users only via use of the include parameter. For example: $args = array( 'include' => array( 1, 3, 5, 99, ...
0
votes
1answer
91 views

Ordering WP_User_Query results by the user IDs used in the include parameter

I'm using WP_User_Query to bring back a list of users. I'm passing a list of specific users to be included in results. For example: $user_ids = array( 1, 5, 9, 61, 24, 12 ); $args = array( ...
0
votes
1answer
222 views

WP_User_Query with combined meta query - not working?

I'm trying to use WP_User_Query class to list all users basing on their specific meta fields. When I use simple single-meta query, it works fine: $q = new WP_User_Query( array( 'role' => ...
3
votes
2answers
209 views

How to search display_name column when using WP_User_Query

I'm using WP_User_Query to bring back a list of users. According to this article, I can focus the query on particular columns (I'm assuming in the wp_users table) using the search_columns param. My ...
0
votes
0answers
79 views

WP_User_query using 'pre_user_query' to select extra meta value fields

I'm looking to extend the WP_User_Query function return extra meta data files for a group of users. I've defined a 'pre_user_query' add_action('pre_user_query', ...
2
votes
2answers
275 views

WP_User_Query order by meta_key that is an array

I have set a user metadata named achievements which is an array containing various numeric values. Using WP_User_Query, I want to order the list by a specific key within this array named points. The ...
1
vote
2answers
196 views

How to get a list of all users registered before a given date?

I was expecting to be able to do something like the following which I thought would return all users that have registered before a given date: $args = array( 'post_type' => 'post', ...
0
votes
1answer
232 views

WP_User_Query with more than two custom meta values

I am trying to create a custom user query based on users' metadata. I have the following query created. $users = new WP_User_Query( array( 'search' => '*' . $search_name . '*', ...
1
vote
2answers
41 views

Conditional IF statement not returning true even though echo of $user->province is correct

I am having a problem with an if statement which I have now tested many times over. $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) ); if ( !empty( ...
0
votes
0answers
52 views

Working with arrays/foreach statements - echo results? Addition operator w/foreach… multiplying?

I'm really struggling with this - I'm relatively new to PHP but I'm trying make this code that I've pulled together output a list of chapters sorted by user pageviews based on a user_meta field called ...
2
votes
1answer
332 views

Query Users by login, meta & role

I'm using pre_user_query to limit the results shown on the users.php page. I am limiting it by role & also by a meta field, so my query from like this: $query->query_from = " FROM ...
0
votes
1answer
740 views

WP_User_Query Custom Field meta_query with Date clause

I have a custom meta field 'bhaa_runner_dateofrenewal' which records the date that a User on my system last renewed their membership, the field format is YYYY-MM-DD. I'm trying to write a custom query ...
0
votes
1answer
89 views

Is it necessary to escape LIKE term in WP_User_Query?

While searching for partial string searches using WP_User_Query I came across this answer by @kaiser who has provided some great answers here on Stackexchange. However, I was confused over the use of ...
1
vote
1answer
279 views

WP_User_Query pulling ACF to loop

I'm using following code to display my users on template <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $paged -= 1; $limit = 100; $offset = $paged * $limit; $args = ...
0
votes
1answer
2k views

Sort WP_User_Query by meta_key value with pre_user_query

I'm trying to order my users by their Member Number - which is a custom meta value. It seems I can't easily orderby a meta_value. I've read a few workarounds but I can't get my head around it. This is ...
0
votes
2answers
46 views

Pagination on WP_User_Query not updating current page

I have the following code which queries for all users (excluding admin) and sort them by the meta value user_business. When there are more than 10 users I have pagination which is currently working ...
0
votes
0answers
138 views

Paginate Links not working

For the life of me I cannot get Paginate links to display pagination, but using 'userp' in the url works for paging. I just need the links to show up. <?php /** * @package WordPress * ...
0
votes
1answer
71 views

Randomize Users

I'm trying to randomly display my users and I was wondering if I could edit the answer on this page to suit my needs (multiple users instead of a single user): Sidebar random author spotlight Here's ...
0
votes
0answers
331 views

Sort users by custom user meta value

I'm trying to sort users by a custom meta value "user_business" which is their business name that way when users are listed they're sorted alphabetically by their business name as they should be. I'm ...
3
votes
1answer
4k views

How can I search for a worpress user by display name or a part of it?

I need to create a search page that will display anything related to the supplied search. i.e. comments containing it, events, posts, CPTs and users with that name. How can I search for users in ...
0
votes
1answer
267 views

WP_User_Query not searching

I currently have the following code, and a user named "Clark Farm" in the user_business table. The code below returns nothing. If I remove the search term then all of the users are listed. I'm trying ...
1
vote
1answer
129 views

Exclude Users of a Certain Role in the Users Page

class MyPlugin { public function __construct() { add_action('init', array(&$this, 'do_member_filter')); } public function do_member_filter() { $users = new ...
3
votes
1answer
286 views

each_connected in wp_user_query with Scribu's Posts to Posts Plugin - Alternative method? [closed]

I have been using Scribu's Posts to Posts plugin for some time, and it has served me well. I have read the full wiki and issues list, but can't find any definitive answer if there is a clean way to ...
0
votes
1answer
345 views

Reduce number of SQL queries inside WP_Query loop to fetch author data

This question applies to scale and does not concern typical blog implementations. I'm working on a web app where I'm running standard WP_Query to fetch some custom post types. This usually results in ...
1
vote
1answer
167 views

Query users by capability - uninstall/deactivate callback

The situation Running on MU, I'm writing an open source/publically and freely available plugin. As I used add_screen_option() to allow users to easily setup the admin page to their likings, I'm left ...
1
vote
1answer
63 views

Save users last visited blogs within whole network

I have a big network with subdomains (many of which use domains). I thought about solving this problem with cookies but after some research I don't think that crossdomain cookies is a best Idea. So I ...
0
votes
2answers
256 views

Listing wordpress users with a search function

I'm having trouble finishing off this code that I adapted from Cosmoslabs excellent tutorial. Everything is working (listing and pagination etc) except the search function whic is returning nothing ...
0
votes
1answer
166 views

Query Users by post count, last 30 days and display each users post count according to post type

I'm almost done, the code below does everything but display post count for each user broken down into post types, and also I'm like to filter it last thirty days. I'm trying to get the post for each ...
4
votes
1answer
83 views

Want to add my custom prepare query but add_filter doesn't run

I want to manipulate the order of WP_User_Query(). I want the user to come out ordered by a custom meta field and by ascending order. I have the code correctly working tested it on users.php but ...
7
votes
2answers
873 views

WP_User_Query to exclude users with no posts

I see that it is possible to sort a user query by the number of posts each user has, but is it possible to exclude users with zero posts from the result? In the Wp_User_Query class there is a ...
0
votes
1answer
70 views

How do I find users by password?

I need to add a passkey to each user, so I decided to just giving the user password that value and use WP functionality to store it/retrieve it. So now I need to find what user that password belongs ...
1
vote
0answers
356 views

Wp_User_Query not sorting by meta key

I'm trying to list users sorted by a meta value. I store a score for each user in their user meta which is just a number but the loop isn't sorting. I include the score in the loop so that I can see ...
0
votes
1answer
149 views

Combining two meta_values within one row with query

I've added two new meta_keys to the wp_usermeta table: bid_user_lat and bid_user_lng And I need to be able to get both of these values within a single row, along with the user_id. ROW - (user_id) ...
1
vote
1answer
1k views

How to use search_columns in WP_User_Query?

I am using WP_User_Query to search use by name, ID, email etc... In that case I need to use search_columns field to pass ID or email of user. What i am doing is $my_users = new WP_User_Query( ...
4
votes
1answer
1k views

Searching users with WP_List_Table plug-in

I am trying to devlope a plugin that will search and return my users so I can edit some other metatdata that belongs to them. I have been using the plug-in listed on the Codex as my starting point. I ...
0
votes
2answers
905 views

Create Mashable Follow-like Facebook, Twitter login/connect?

Hi want to ask if anyone can share an idea on how Mashable registration works? Basically the only option you have to register to their site is by Facebook or Twitter, after you login to one of them ...
3
votes
1answer
4k views

How to display pagination links for WP_User_Query?

I think I'm nearly there with this, but I can't get the pagination links to show for a directory of authors I'm creating. My code is below, but I don't know how to get the links to navigate between ...
1
vote
2answers
347 views

List Users alphabetically with heading

How can I show a list of Users with alphabetical headings? For example: AAdamAlan BBillBob I've found examples that do it with Posts, but I can't figure out how to make it work with WP_User_query() ...
0
votes
1answer
631 views

WordPress WP_User_Query($args) using Where and Like

I wish to return a WP user list in my plugin where the email address matches @mydomain.com. The user list I am after is for all mydomain.com users. Does anyone have a code snipit for that? Thanks.
1
vote
1answer
4k views

Getting all user metadata from user

I am trying to show bio and other custom metadata for my users in a page. So, i want to query the user metadata table for it. I have tried but did not find any functions for that. What i am looking ...