Questions tagged [wp-user-query]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
4k 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 ...
1
vote
1answer
713 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 ...
1
vote
1answer
321 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
73 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 ...
1
vote
0answers
51 views

WP_User_Query - searching multiple fields

I have a search engine where I can search for users on the front end. Profiles have mulitple custom fields. I'm just searching first and last name in this example. The problem is I can search for a ...
1
vote
0answers
23 views

What's the proper way to add users to my site in order to test things?

I'm new to wordpress. I'm have my site just running on localhost and want to test some things out with dummy data/made up users. When I log in to my wordpress database, I see that there is a table ...
1
vote
1answer
38 views

Upload Video and preview

I have a question about videos in WordPress. Is it possible to let my users upload videos and show the preview in their profiles? Not have a video post page, just the user can see a preview in low ...
1
vote
1answer
35 views

Get users that likes the post

I have an ajax like posts system when a user like a post the system added a post meta to the post and it's named (post_liked_users). Example of post_likes_users meta value: a:1:{s:6:"user-1";i:1;} ...
1
vote
0answers
535 views

Is there a maximum limit of the number of users returns by WP_User_Query?

I’m working on a search form which filters the users . Everything works but the result is always limited to 299 users. Here is my code which is vers basic : $args = array( 'orderby' => '...
1
vote
0answers
137 views

Two queries for a WP_User_Query search work perfectly apart, but not together

I'm putting together a page that pulls User data and displays it in an attractive social-media-like format. I want to use a variable passed in through an input on the site to search multiple fields, ...
1
vote
0answers
107 views

Passing args to WP_User_Query am I using meta correctly?

I am hoping someone with more expertise can help me here. I tried passing specific args but the script wouldn't work as expected. Basically it lists all users who ticked a custom tick box that says ...
1
vote
0answers
527 views

WP_User_Query search with multiple search queries

Is it possible to perform a WP_User_Query with multiple search queries? Something like: $args = array ( 'search' => '*example.com OR *abc.com', 'search_columns' => array( 'user_email'...
1
vote
0answers
49 views

WP User Query Issues

I am trying to create a search of users to search for them using their first name, last name, billing phone, ID, or email. I have the following code written, but it does not pull in the correct data. ...
1
vote
0answers
45 views

Accessing current users data within a plugin

I have been working on a WordPress plugin for a couple of days, and I got it to the point where it works - I was however unhappy with the procedural code (I was rushing it for my site, to come back to ...
1
vote
1answer
111 views

How to activate the user search

I'm trying to activate the user search in my wordpress site. Which means that I want also the users on the search result. I have tried some plugins, but none of these gives the solution I want. Is ...
1
vote
2answers
48 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( $user_query-&...
0
votes
1answer
1k 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.
0
votes
1answer
97 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
1answer
33 views

Normal PHP array for exclude section of WordPress query?

I just wanted to check on something with the community here and avoid any future drama. I have a variable which seems to be working fine in a wp_user_query but not sure if I'm missing something that ...
0
votes
1answer
24 views

How to get the count

How to get the count of the WP_User_Query result while I use $query = new WP_User_Query( $args ); echo count($query); It returns 1 when there is no user. But I need 0 in that case. How can I get ...
0
votes
1answer
39 views

How can I prevent certain custom roles from seeing other custom roles on the user list page?

So I am building a system with 3 different custom roles - Admins, Providers, and Users. Providers have access to users.php, or the list users page. However, they should not be able to see/edit/access ...
0
votes
1answer
54 views

creating new field on mysql

I would like to add extra sections like "gender" on the WordPress user database. I would like to draw information from this information later. For example, let's say I want to attract gender. I ...
0
votes
1answer
333 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
1answer
827 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 ...
0
votes
1answer
55 views

WP CLI - show users whose ID is larger than given ID

The below code achieves what i need for given ID = 200. wp user list --role='customer' --orderby=ID --order=asc | awk 'FNR == 1 {next} $1>200 {print ;}' How to do it with wp user list and WP ...
0
votes
1answer
46 views

Get users between user ids

How select users between 100 and 200 user ID's? Or select users which ID less then 200? $args = array ( 'query' => array( array( 'key' => 'ID', 'value' ...
0
votes
2answers
1k views

WP_User_Query unable to retreive all user at once

I have more than 3000 users with role 'subscriber', and now i want to fetch all users with role 'subscriber'. $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) ); $users = $...
0
votes
2answers
557 views

Add Watermark to PDF's of logged in user in WordPress upon upload to media library [closed]

How can I add a watermark to my PDFs that are uploaded via the media library of the logged in WordPress User when viewing and printing the pdf. I have tried utilizing plugins but they are all limited ...
0
votes
1answer
159 views

WP_User_Query and user posts

I queried a list of users using WP_User_Query from which I got the avatar, name and a few ACF that I created for the user registration. Now, I need to obtain a post list of each of the users in my ...
0
votes
1answer
95 views

construct complex queries with WP User Query

Is it possible to create complex query with WP User Query ? With WP Meta Query, we can make complex queries with Nested arrays like : $meta_query_args = array( 'relation' => 'OR', // Optional,...
0
votes
1answer
203 views

How do I remove duplicate users from two merged WP_User_Query objects?

I'm trying to write a search that makes use of several custom user meta fields I've created, but was having a tough time implementing them. Basically having the same problem this guy was having, and I ...
0
votes
1answer
746 views

Change users.php WP_User_Query

A client has requested to have two kinds of custom user roles, and have those users displayed in an Admin Menu Page of its own. So far, I've achieved that using WP_List_Table with success. Now, the ...
0
votes
1answer
184 views

How to put an array in wp user query

I am quite new to php and wordpress developement, and I am also new to this website. I want to learn development by trial and error. Please forgive me if i don't use all proper terminology. I have ...
0
votes
1answer
590 views

WP_User_Query Filter Results

I'm struggling to apply some filters to WP_User_Query, I have the following query, followed by some filters also shown, when I apply the filters they appear within the url structure, so /?gender=Male ...
0
votes
2answers
824 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
1answer
61 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
2answers
613 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', ...
0
votes
1answer
803 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 . '*', '...
0
votes
1answer
2k 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
2answers
173 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
1answer
857 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 ...
0
votes
2answers
558 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 i....
0
votes
1answer
235 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) ...
0
votes
1answer
615 views

Is it possible to use WP_USER_QUERY to search by username using a wildcard? [closed]

As above guys, I'm trying to build an AJAX search that works within BuddyPress WITHOUT modifying core code, but that allows me to use a wildcard when I'm searching by username. Any suggestions?
0
votes
0answers
31 views

WP_User_Query Search Multiple Keywords from a Multi-Select Field?

My code below works to list a single user when I ask to search for a single username; however, I am unable to list multiple users when asking to search for multiple usernames. Here is a brief ...
0
votes
0answers
54 views

Query users by custom field

I want to get the users who registered within last 7 days, and meanwhile who have uploaded custom avatar. I've added a function allowing users to upload their own avatar img with a custom field ...
0
votes
1answer
33 views

How to query 5 users in random who have published more than 10 posts

I want to display 5 users who have published more than 10 posts, when the page loaded again, it should show another 5 users or mixed with new users with more than 10 posts. How do I achieve this? ...
0
votes
1answer
80 views

WP_User_Query with 2 sets of conditions 'AND'

I would like to write some arguments for my query and both need to be true. I am having trouble with the Syntax. 'meta_key' => $campaign_type, 'meta_value' => $Campaign_ID, AND 'meta_key' => '...
0
votes
1answer
28 views

Periodically Query an external API on wordpress site

I am creating a wordpress site that will periodically retrieve data from an API and use that data to update info in the wp_users table. I don't really know how to go about this. I'll start with 2 ...
0
votes
0answers
28 views

unable to modify user table search results based on meta key

I would like to modify the pre_user-query wp_user_query to include a meta fields from the user meta. I have tried the two following methods, neither of which work (both return empty sets): $query-&...