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

learn more… | top users | synonyms

0
votes
1answer
25 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', ...
0
votes
1answer
29 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
25 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 ...
0
votes
1answer
24 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
71 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' => ...
1
vote
1answer
65 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
13 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
15 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
33 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
54 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
43 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
64 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
83 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
45 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
133 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
150 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
19 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
412 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
76 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
2k 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
59 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 ...
3
votes
2answers
131 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
62 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
216 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
153 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
48 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 ...
0
votes
1answer
130 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', ...
0
votes
1answer
101 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
313 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 ...
3
votes
2answers
794 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
240 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
105 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
437 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
681 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
340 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
336 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
222 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 ...
2
votes
2answers
429 views

Efficiency on displaying random authors based on large database

I'm trying to display a list of 5 authors randomly. Here are some solutions I had found: http://stackoverflow.com/questions/5502609/get-authors-randomly ...
1
vote
2answers
356 views

Adding tags and inputs to a user's profile

I'm adding a number of items to the user profiles using this method in my functions.php function modify_contact_methods($profile_fields) { // Add new fields $profile_fields['twitter'] = ...
0
votes
1answer
390 views

Query to get last posts from authors of blog

Firstly I get user with role "author". $author_args = array( 'role' => 'author' ); $authors_list = get_users($author_args); Nextly I reform array $author_list = array(); ...
1
vote
1answer
540 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
137 views

Update user from external script

I am using the API code of WordPress to update some fields of user profiles but I am having some problems. When I try to save information, it is not updating unless I click twice. For example for ...
1
vote
2answers
1k views

Get author id from url

I am trying to get the authors user_id on a page linked to by using get_author_posts_url(),. For example http://example.com/author/John%20Smith where John Smith is user_id is 23. I need to get ...