Wrapper for WP_User_Query. Retrieves an array of users matching specific criteria.

learn more… | top users | synonyms

0
votes
0answers
21 views

Filter User Query

I am using the code below to display all of my users on the front end. <?php $args = array( 'meta_key' => 'last_name', 'orderby' => 'meta_value', 'order' => 'ASC', '...
0
votes
1answer
26 views

get_users meta_query: REGEXP not working for matching new lines

I have a meta field "my_meta_field" which may contain the following for these sample users: User A 99999 559225 12519 User B 5020492 99999 125191 User C 194295 1199999 Newlines are \r\n or \...
0
votes
2answers
40 views

Get Sticky User in user loop based on user role

I have this shortcode to display a loop of user avatars with order by registration date. function Profiles() { $args = array( 'orderby' => 'registered', 'order' => 'DESC', '...
0
votes
1answer
23 views

How to get all posts belongs to a user between a certain date

I am writing a plugin for my company so I need to get all posts belongs to a user between a certain date which is given by another user. Then I want to count words for each post and finally add them ...
0
votes
1answer
18 views

Suggest Users basing on User taxonomy

My question is for getting informations or directions about how to move for a task I have to do. This is just a request for advices due to the fact I'm not an expert in wordpress development. My task ...
0
votes
1answer
29 views

How to order users alphabetically by name? in plugin UPME

I have this code: <?php class UPME_List_Cards { public $upme_options; public function __construct() { global $upme; add_shortcode('upme_latest_members_list', array($this,'...
0
votes
1answer
30 views

How do I retrieve a users' last 5 posts?

How do I retrieve a particular users last 5 blog posts? Currently, I am trying the following approach, but it seems that it is retrieving the actual post titles and permalinks: <?php $...
0
votes
1answer
30 views

'pre_user_query' interfering with user export

I needed to add sortable columns to clients wordpress for custom meta data I created so I used a pre_user_query hook add_action('pre_user_query', 'user_column_orderby'); function user_column_orderby(...
0
votes
1answer
27 views

List users of specific role instead of removing them with specific role

I am currently listing all the users except users with administrator role on custom page template with: <?php $allUsers = get_users('orderby=post_count&order=DESC'); $users = array(); ...
0
votes
0answers
72 views

How can I fetch all users who are at or above X role?

What is the best way to get all users who are above a certain role, like 'author'? Is this the best way? $user_args = array( 'meta_query' => array( array( 'key' => '...
2
votes
1answer
120 views

Retrieve all users from wordpress database via REST/JSON API

I've read that the WP REST API v2 retrieves only users that have made a post for the blog. I'm developing an iOS and Android app that needs to use the Wordpress registration. How I could retrieve a ...
0
votes
0answers
15 views

Custom search for users

I've coded this up and it works great to search for "John" as a wildcard: $your_search_string = 'John'; $user_list = new WP_User_Query( array( 'search' => '*'.esc_attr( $...
0
votes
0answers
17 views

track logged in user link/clicks

I'm stumped here. I'm trying to track specific links on my site and report back time stamp of when a user clicked that link. These are for specific downloads and only registered users can access the ...
0
votes
1answer
35 views

How to get all logged in user id in buddypress [closed]

I want to get all buddypress logged in user's ID. for that sake i am using $bp->loggedin_user->id But this is not helping.. Please help me to get all logged in user id. Thanks.
0
votes
1answer
58 views

I try to add informations to User profile

I try to add information fields to User profile. But my code doesn't run! :-( In functions.php I add: function add_contact_profile($user_contact) { $user_contact['twitter'] = __('URL Twitter'); ...
0
votes
3answers
47 views

List all users based on array of domains

I would like to display a list of any users whose emails are detected to have email addresses from an array of domains. $domains = array('domain1.com', 'domain2.com', 'domain3.com'); If any users ...
1
vote
2answers
70 views

How to get top 10 user is based on user meta value

I'm trying to get top 10 users in my wordpress blog based on user meta value. I've tried few methods & finally able to get just top one user using below wpdb query. But clueless, how we can get ...
0
votes
1answer
96 views

How can I sort get_users() by any value (last_name, user defined fields and more)

I want to sort the result of get_users() by last name, first name, user defined fields or whatever. How can I achieve this while still using get_users()?
1
vote
1answer
51 views

get_users() timeout on big userbase — options to divide query?

We run a daily cron that gets all the users' data and updates their values. The problem is that get_users() is timing out because of the big userbase. Yes, I can update the php.ini file and increase ...
0
votes
0answers
148 views

Get_users doesn't return all wp user data fields after search

I want to get all wordpress users which have some string in their user_login. I use get_users with search parameter but it return only id in WP_User->data. I need all data fields (user_login, ...
0
votes
1answer
165 views

Wordpress /users/me endpoint request forbidden

Using Wordpress's plugin WP REST API version 1, there is an endpoint called /users/me which response with data for the currently logged-in user. When I requested /users/me I got 403 Request Forbidden ...
0
votes
0answers
20 views

Getting ID of user being edited [duplicate]

I wonder if i can know the id of the user being edited "edit_user page" while i'm my code in functions.php page I want to get the user_id from the database, that's my database code: '$...
2
votes
1answer
26 views

Get users only if Gravatar is specified

I would like to retrieve a list of 12 Wordpress users, but I would like to have them randomly (at each page reload) AND only 12 users that have a Gravatar specified. Right now, I have my 12 random ...
0
votes
2answers
511 views

get approved users only ( ultimate member plugin )

I am using UltimateMember and I have the settings configured that admin must approve registered users first. I now want to display the approved users meta information like faculty, email, etc. in the ...
0
votes
0answers
17 views

Member Rating/Feedback

Need help for the rating system for users. I have created a custom profile template for the user profile and try to add a feedback form. This form is submitting a custom post types and has two custom ...
0
votes
1answer
80 views

How to List only the users created by a particular user

How can I list only the users created by any particular logged in user. Suppose,I'm a Subscriber and there are users already registered, I then added User1(as Associate), User2(as Subscriber). When I ...
0
votes
1answer
3k views

How to get users by a custom field / by user meta data?

I've added a custom field to users profile using the following code: /*** Adding extra field to get the the user who creates the another user during ADD NEW USER ***/ <?php function ...
0
votes
1answer
68 views

How to get a users list by who created them?

I have two users with the capability to create other users. But their roles are not same. Tom - Role is Administrator Jackie - Role is CMS Manger (a custom created role) Both have capability ...
4
votes
2answers
141 views

What is the most efficient way to search users by their display name?

Initially I thought I'd use get_users() but it turned out it doesn't support the display_name field. Then I've read about using WP_User_Query, but when I do it always exhausts the allowed memory size ...
0
votes
1answer
65 views

How do I change the home page to the registered user's profile page

I have a custom profile page for my users. I need to have wordpress redirect the homepage to the user's profile page if they are logged in. If they are not logged in or registered, wordpress would ...
0
votes
2answers
229 views

get_users with Serialized Custom Meta Value

I'm attempting to use get_users to select users with only a certain meta value. In this case the meta key is extraInfo but the the values are in a serialized array. Can I pull users out like this? ...
0
votes
2answers
165 views

Get current user outside of Wordpress Multisite

How to get current logged in user in Wordpress Multisite outside of it? I tried the method for Wordpress Singlesite and it give the error Call to a member function set_prefix() on a non-object on ...
0
votes
1answer
53 views

Iterate through users and display users meta info at front-page

I have a meta field in user called columnista-destacado I need to iterate through Wordpress users and if that field has valued set (lets said equal 1) then I need to display user meta info at front-...
0
votes
1answer
138 views

How to set custom upload directory per user after moving content directory

I set the content and the wordpress directory of wordpress like described in the codex: define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/wordpress'); define('WP_CONTENT_DIR', dirname(...
0
votes
1answer
112 views

List of users with email and role

I'm looking to create a list of all the users on my wordpress site with their email and role. $blogusers = get_users(); // Array of WP_User objects. foreach ( $blogusers as $user ) { echo '<...
1
vote
5answers
4k views

How to check if a user exists by a given id

Is there any way to check if a user id exists? I want to create a function similar to username_exists() but which returns if the id exists or not.
1
vote
2answers
339 views

Select Multiple meta_value from WP DB; Single Query

I am trying to retrieve each user's first and last name, phone, email, and address from the usermeta table. I'm having trouble selecting multiple meta_values, each with its own meta_key, using a ...
5
votes
2answers
889 views

Display list of users who have made at least 1 post

What I would like to do is have a list of users who have contributed at least one post. I need to show the following: [User photo] | [User Name] | [User post count] e.g. [photo] Joe Bloggs(8) I ...
0
votes
2answers
269 views

Is a user_meta research case-sensitive or not

I am using the Wordpress get_users() function to search for users with a specific meta_key value. $wordpress_user = get_users( array('meta_key' => 'unique_id', '...
0
votes
2answers
111 views

Cannot retrieve active members only

Below is a page template where I'm trying to retrieve active members metadata (of Restrict Content Pro). Displaying users' meta is working just fine; but I can't get ONLY active members to display, ...
0
votes
1answer
464 views

Get author meta of all writers

We know from the docs that you can get an author's meta like so: <?php get_the_author_meta( $field, $userID ); ?> But I would like to have a custom "About us" page which displays all the ...
0
votes
1answer
62 views

Wordpress where clauses in db select

I'm currently struggling with implementing a feature for wordpress site. I would like to get the count of all users which have the key pending_approval='true' and is_photographer='true' (located in ...
0
votes
2answers
735 views

Order get_users() by last login date. Is it possible?

I want to create a page that displays all the blog users ordered by the last login date. I've tried with the get_users() function and I can succesfully get the users' list, but not in the order I ...
1
vote
2answers
367 views

Displaying a random user with a shortcode

I'm trying to setup a shortcode to show a single random user each time the page is refreshed. I've been successful in displaying all users or a select user by the user ID. Here is my shortcode as it ...
0
votes
0answers
50 views

How to get the list of users logged in to wordpress and expose it in JSON?

Is there a way to get the list of users logged in to wordpress site and expose it in JSON? Please throw some lights to achieve this.
0
votes
1answer
346 views

get_users() ORDER BY Not Working

I'm not sure where the problem lies, but the code below just doesn't have the effect of ordering by ID in descending order. $args['role'] = 'subscriber'; $args['orderby'] = 'ID'; $args['order'] = '...
0
votes
1answer
242 views

Order users by number of posts (includes custom post type)

I am using the function below to count posts for users (including custom post types). I am putting together a list of users and want to order them by this count function. The orderby options for the ...
1
vote
2answers
1k views

global $current_user not current user

I believe I have a misunderstanding of what the global variable $current_user is exactly. I'm attempting to display the current user's email and name on a page using add_filter('the_content', '...
1
vote
0answers
49 views

How to get Role Subscribe Users on Admin Menu only in Pages in Wordpress

How to get Role Subscribe Users on Admin Menu only in Pages in Wordpress and also asign pages to only a specific user and also get the pages on homepage by user ID. Example: here a link, i want to ...