Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [get-users]

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

0
votes
1answer
12 views

Get all user meta_keys and then group users by matching values

One of the plugins I am using generates user meta from our AD. One of the keys is the user's Manager. As many users will have the same manager, I want to be able to group all users. I was trying to ...
1
vote
4answers
239 views

get_users(…) only returns one user

I have an array of user IDs, I want to get data for each of these users. I first thought of writing a classic SQL query but I found WordPress has integreted functions for it. However, get_users(...) ...
0
votes
1answer
24 views

Send admin new order email to logged in user as well

I need to be able to send the admin email for a new order also to the e-mail address linked to the current logged in user. This is required as 1 account is for different people (people who give a ...
0
votes
1answer
23 views

How to get user details by name

I am new in WordPress. I want to get user details on frontend without login in WordPress when the user types his name in browser URL (Like example.com/{user-name}) and hit enter, User redirect a new ...
0
votes
0answers
11 views

How can i export images and videos on wp personal data export page?

Is there a way to export user's profile photo in the WordPress user data export page. I have created users and i gave each one of them a profile photo. The problem is, when i export their data to the ...
2
votes
0answers
33 views

How can I find users that didn't set a password?

Is it possible to find (and bulk delete) users that registered on my WordPress site but never set a password over their confirmation email?
0
votes
0answers
59 views

wp_get_current_user Not working

I am using the wp_get_current_user() function inside a hook which fires before email is sent from contactform7 . The function works but the main problem is that the function doesnt return the current ...
0
votes
0answers
18 views

Sync users from production and development environments using wp cli

I want to sync users registered at production environment to development environment. Using the below command sequence for this: 1) Find max user id at the target dev environment using: wp ...
0
votes
0answers
28 views

get_user_by() sometimes returns false, but the user exists

I am using child theme and I am replacing the base action for registering a user in my child theme: add_action( 'wp_ajax_nopriv_parent_theme_ajax_register_form', '...
0
votes
0answers
34 views

simple click counter for current_user

I am trying to create click counter with Ajax for login users. I have multiple subscriber in the blog and need to count there clicks. HTML: <a id="countable" href="#">Click Counter</a> &...
0
votes
0answers
41 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
2answers
22 views

User meta query results in PHP notice: only variables should be passed by reference

I am using a URL rewrite to put the user's display name in the URL to display a user profile. This part all works fine and the proper value is passed through the query_vars and I can get the correct ...
0
votes
1answer
35 views

How to avoid duplicate users when I am using get_users?

I using get_users to get users from my database. I am using this code: $args = array ( 'role' => 'Colaborador', 'role__not_in' =>[ 'subscriber', 'Administrator'], ...
0
votes
1answer
34 views

Show Wordpress users in grid with image and name

I'm looking for a way to display Wordpress users on a page in a grid. Ideally with an image and a name. It's for a face book page (not Zuckerberg's blue version) on a company's intranet. In my ...
0
votes
0answers
39 views

Merge wp-query and get_users

Is there a way of merging get_users() and and WP_Query() into one query so I can paginate the results? I have two entities; users and companies. Both can be members but users are users and company is ...
10
votes
3answers
659 views

How to get WordPress Username in Array format

I want to create an Autocomplete function in WordPress. I want a search field from where username can be searched. I am using following JQuery UI. <label>Users</label> <input type="...
0
votes
0answers
17 views

Finding users by a specific criteria

I want to create a website for multiple users to get together. I will be using the BuddyApp theme (https://themeforest.net/item/buddyapp-mobile-first-community-wordpress-theme/12494864). This, ...
0
votes
0answers
65 views

get_users by role returns all users

I am trying to fetch all users with a specific role eg blogger and blogger_pro but my code just returns all users rather than those with that specific role. Hope someone can tell me whats wrong? The ...
0
votes
1answer
17 views

show user based on user_meta

it's possible to show user if my logic like this it's better to give illustration USER I have two users with usermeta: user A have usermeta country with value "USA" and univ with value "UCLA" user B ...
-1
votes
1answer
178 views

file upload user profile

I am working on a medical reporting site in wordpress, where the requirement is that admin can upload a seperate .pdf file to different users' profile & only the profile owner can download it
1
vote
1answer
66 views

Get_Users Orderby Page

I've been trying to fix a sorting issue using the codex for get_users(), but I can't seem to get it working. The codex shows that I can set 'orderby' => 'post_count', but I want to change this so ...
1
vote
1answer
29 views

exclude roles from overview

I am re-using some old code on a new website where I show all users in a listing with last post image as background. This all works fine (I know the get_users_of_blog is deprecated, but when I use ...
0
votes
1answer
42 views

Get the users that my following users are following

I have a social site that contains follow users system. Each user has two custom meta: following_users followers_users My question how can get the users that my following users are following? I ...
0
votes
0answers
63 views

How to get the id of recently registered user from database?

I just want to get the ID of the recently registered user using my custom created registration form. Here is my code. $user_id = wp_insert_user( array ('first_name' => apply_filters('...
0
votes
1answer
43 views

Storing data to database and user registration

The project that I'm working with have a quote form. When someone submit the quote request, the information should be stored into a new table in the database and also prompt the user to register an ...
1
vote
1answer
588 views

How to pass user meta_key and meta_value (values as array)

I want to pass user meta_key to meta_value, but the meta_value array is like this: $user_biodata = array( 'register_facebook_id' => 1311064406686333, ); I want check if user is already ...
0
votes
1answer
29 views

Query for user roles and their skills

I am trying to get all those users having role as candidate and 3 skills as follows. skill a, skill x, skill e. Only want three users, What I am missing $args = array( 'role' => 'candidate', ...
0
votes
1answer
34 views

Can someone help me out? Why isn't this working?

//Auto Delete Expired Users function delete_users(){ $bloguser = get_users( array( 'role' => 'subscriber' ) ); foreach ( $bloguser as $user ) { if ($user->user_url == 'http://day' ...
0
votes
1answer
140 views

How to search users globally on a multisite install?

I'm using the REST API to create/update/delete users on a multisite install in order to sync data with a 3rd party resource. When I am checking whether to update or create a user, I'm using the search ...
1
vote
1answer
98 views

Query users which have same dynamically generated roles as the current user

I need to check if users have the exact roles for the purpose of allow users to edit each others posts if they have a same two roles. One role 'X' is a common one, and the other role 'Y' is a unique ...
0
votes
1answer
56 views

WordPress session times out - but doesn't log out?

Since migrating our WordPress site to a new webserver, we have had issues where users are apparently getting logged out...but yet aren't. What I mean is, on our old server, users would sometimes get ...
0
votes
2answers
1k views

Get User ID from within a plugin

I want to get the current user id from inside my plugin and use it as a variable. My code is $current_user = wp_get_current_user(); $user_id = $current_user->ID; $loc_statuss = $wpdb->...
0
votes
1answer
391 views

WooCommerce Admin order - Only run action if user is loaded

I am using this plugin to switch users. I have found a snippet that allows you to switch user on the WooCommerce admin order page which is very helpful. add_action( '...
0
votes
1answer
19 views

How to retrieve custom profile fields associated with different users

I'm working on a very simple wordpress plugin that checks the database for existing users and returns specific profile fields associated with these users e.g bank account number, mobile number with ...
0
votes
1answer
66 views

List users by Year of Birth using a foreach loop to dynamically populate years and data

I have a custom meta_key called "date_of_birth" i am trying to create a table of user counts for each year based on that value. I have this code to count by specific year and also to calculate the ...
0
votes
1answer
105 views

Display current user's custom post meta in sidebar

I'm trying to find a way to display the current user's custom post (each user has only 1 post) content/meta in the sidebar, so the current user can see their custom post's meta. This is what I have so ...
0
votes
0answers
120 views

Custom user query - orderby meta_key (that may not exist)

I'm in need of someone who knows MySQL better than I do! I've started writing a custom statement, but I'm not an expert with mySQL and it's not quite there (I'm happy to scrap it entirely if there's a ...
0
votes
1answer
27 views

Paid Memberships Pro, Display User Limit

I have this piece of code I'm trying to polish up and set a limit to. Everything seems to work except for the limit part. Instead of it showing all the profiles, I only want to show 16. The value 2 ...
0
votes
1answer
659 views

Get multiple users with meta value in one query and populate WP_User class

Hopefully someone can help me with this. When you load multiple users with get_users() (let's say 100+) WP triggers the user meta query for every single user. This triggers 101 queries (main user ...
0
votes
1answer
27 views

Let logged-in users use radio buttons (yes and no) to exclude their author profile from the user listing

I would appreciate if someone could point me in the right direction because I am stuck when it comes to solving the following issue. So I have a directory listing of WordPress users (http://192.99....
0
votes
1answer
2k views

How to get user meta value in wordpress

I have created a custom usermeta field named "designation" and fetched all its meta value in loop but it shows duplicates and empty values. I have tried to resolve by using array_unique() function but ...
0
votes
1answer
75 views

Show subscriber id in loop

I want to show student (subscriber) id in a foreach loop. here is my code $args = array ( 'role' => 'student' ); $wp_user_query = new WP_User_Query($args); $students = $wp_user_query->...
0
votes
2answers
298 views

How get meta from all users?

I want to get all users with their respective data. I already get all the users: $users = array(); $users_query = new WP_User_Query( array( 'role' => 'subscriber', 'orderby' => '...
1
vote
2answers
132 views

Order users by last word of last name

This is probably a typical Dutch issue where you have a last name which can contain multiple words. For example Robin van Persie or Mark de Jong. Currently I have a list of users ordered by last name,...
0
votes
2answers
340 views

Every time I use wp_get_current_user() my plugin breaks

I have been trying to make a sign-out plugin that allows users to sign out from military training activities that they should be at. After they fill out a form explaining why they are not going to be ...
1
vote
1answer
95 views

Do not execute If User is login as Administrator or any Specific Role

How can I not execute some <script> </script> if the user is an administrator or any specific role? Basically I need to do something like this: <?php if( !User( 'Administrator', '...
0
votes
1answer
515 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 \n. ...
0
votes
2answers
431 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
32 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
33 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 ...