Questions tagged [get-users]

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

0
votes
1answer
12 views

How to get user ID's from multiple usernames?

I am trying to produce user ID's from multiple specific usernames. The usernames are pulled from a profile field, and any number of usernames will be called. I want the user ID's from each of the ...
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
3answers
22 views

Return all users that have one or more published blog posts

I am working on a plugin for which I need to create an array of all users (name and ID) that have one or more publish blog posts. Looking at the documentation for get_users() it does not seem to ...
-1
votes
1answer
21 views

Get users query makes the site loading time too big?

I'm trying to get the top 10 users in (specific roles) by the highest post views, but this code makes the site loading time too big, and I don't know why! I'm highly appreciated your help. <?php ...
0
votes
1answer
36 views

REST API GET users

when I do http://dayroomstay.com/wp-json/wp/v2/users I get: "code": "rest_user_cannot_view", "message": "Sorry, you are not allowed to list users.", "data": { "status": 401 } I ...
2
votes
1answer
27 views

How can I default to all WordPress roles when parameter is not included in shortcode?

I am trying to set up a generic shortcode in WordPress with parameters for user meta key, meta value and roles that will count the total number of profiles that include certain values. So far I have ...
0
votes
2answers
32 views

Print WordPress username id inside JavaScript

Hello am trying to print the user id inside an JavaScript <script type="text/javascript"> Li.re('ab12','$user_id'); </script> i wanna output like <script type="text/javascript"&...
0
votes
0answers
22 views

Fetching all users that didn't post with rest api (current version 2)

By default, wordpress only shows you the users who have posted on the site through the /wp-json/wp/v2/users I want to fetch all users whether they have posted or not (using wordpress as a headless ...
0
votes
1answer
14 views

get_users - Sort by a different meta_value than search criteria

I have this code and it works fine but it is not sorted. $args = array( 'meta_key' => 'pw_user_status', 'meta_value' => 'approved', ); $users = get_users( $args ); ...
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
262 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
37 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
24 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
12 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
85 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
22 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
36 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
53 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
49 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
30 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
45 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
36 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
43 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
736 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
81 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
18 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
223 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
79 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
65 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
49 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
677 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
38 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
194 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
102 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
59 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
466 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
21 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
70 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
112 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
127 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
702 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 ...