Questions tagged [wp-user-query]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
23 views

Getting current user data with MySQL statement

There are many widgets in Elementor which allow using MySQL statements to populate some data field. What I am trying to do is populate a field with a specific user's order data. The problem I am ...
0
votes
1answer
25 views

How do I echo all users' display_name and their meta_value who have a certain meta_key?

I have a meta_key inside the table usermeta called 'sms_subscriber'. The meta_value for it is their phone number. I want to echo a list of all users who have that field; in other words, a list of each ...
0
votes
0answers
68 views

Wrong result in fetching User meta of WordPress

I have custom post type Task where I assigned Users as Volunteers. Now I would like to fetch how many tasks assigned to a Volunteer. I am using below code. $users = new WP_User_Query(array( '...
0
votes
0answers
12 views

How to query users to count all with a custom capability and limit it to a set of roles?

On a site with 12 custom user roles I need to count users with the 'supervisor' custom capability but limited to four specific roles. The following code counts all users with the 'supervisor' ...
0
votes
1answer
40 views

WP_User_Query ignoring 'meta_query' arguments

So, I'm trying to do a query on 'members' based on some inputs from a form using AJAX. The thing is that when searching for a 'role' I get the expected result. But once I try to look for other meta ...
0
votes
1answer
31 views

last_name + first_name orderby with meta_query [solved]

I have small issue with orderby. I´m looking solution to orderby ASC (lastname + firstname) example: Selanne Andy Selanne Beeny Selanne Teemu But now it arrays something like this: Selanne Beeny ...
0
votes
1answer
47 views

Dokan Marketplace store link in single product page

I use this this way to display product store link with [vendor_shop_name] shortcode in custom product page. /*Shortcode [vendor_shop_name] https://stackoverflow.com/questions/55364574/display-dokan-...
0
votes
0answers
21 views

Issue with user meta_query

I am creating a zip code radius search. I am pulling the all the zip codes within a radius depending on the search term through an API, then doing a user query to compare a custom meta field that has ...
0
votes
1answer
28 views

Get a Post Loop based on Logged in User information into a Shortcode

I have a follower button on users profiles where users can follow other users. I have a page template that shows all posts by users the currently logged in user follows. I would like to create a ...
0
votes
1answer
15 views

array of meta values using WP_User_Query

I don't see that it is possible when I look at the WordPress documentation but I wanted to confirm. I want to check multiple meta values against one meta key eg: $user_query = new WP_User_Query( array(...
1
vote
1answer
37 views

Wordpress search posts by author name with autocomplete

I am using autocomplete code as follows: functions.php // add the ajax fetch js add_action( 'wp_footer', 'ajax_fetch' ); function ajax_fetch() { ?> <script type="text/javascript"> ...
2
votes
1answer
28 views

Echo the number of users using WP_User_Query?

Ok, so right now I can easily echo the number of posts that has a specific meta_key and meta_value: $query = new WP_Query( array( 'meta_key' => 'usp-custom-1', 'meta_value' =&...
0
votes
0answers
25 views

Link multiple user databases together?

Okay, so I am helping in website design and social media aspect of a game my friends are developing, and I want to be able to sync my Wordpress user database, game wiki user db and the game's database....
0
votes
0answers
45 views

How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?

I am looking for some assistance with how I can filter AND/OR sort my WP query while on a taxonomy page. Essentially, what I am looking to do is have all users listed in alphabetical order on the ...
0
votes
0answers
21 views

Hide autocomplete and fetching users when adding existing users WP multisite

Normally in the Add User section in a WP multisite, there is a section that you can add an existing user of the network to a subsite. When typing to add an existing user the autocomplete function ...
0
votes
0answers
19 views

How to display buttons - next / previous author. On the author's page

I want to be able to list authors on the site inside their personal pages. But I do not understand what request to create, how to display the previous user or the next one relative to the current ...
0
votes
0answers
130 views

How to create a custom filed to upload a user profile pic/avatrar on the wp default register form? without plugin

I need a field that uploads the profile picture of the user-user profile picture who wants to register from the wp default registration form. so for that, Anyone, please help me with how to add an ...
0
votes
0answers
16 views

Hide users on users.php with a specific meta value

I am using the User Switching plugin in order to allow sales agents to place an order on behalf of a customer. I want to allow sales agents to switch into their customers only instead of all customers....
0
votes
0answers
70 views

Query users and count totals based on meta values

Users can choose a value from a multiple choice checkbox on sign up. In this example the choices are Cat or Dog. I have a WP User Query and want to count the amount of users that have each meta value, ...
0
votes
1answer
61 views

How to combine two get_users() array?

The $q1 and $q2 are working well individually. if (!empty($search_term)) { $q1 = get_users(array( 'fields' => 'all', 'role' => 'contact', 'search' =&...
0
votes
2answers
73 views

Can you return users of a higher role than the current user using get_users()?

I am using get_users() to return a list of users with specified roles. The purpose of this is to generate a dropdown on the front end to mention other users in comments, very similar to the ...
0
votes
0answers
46 views

Compare time value in WP_User_Query for sending emails

I am trying to setup a custom plugin that will compare the time (last activity of a user) and send emails to them. I am using the below WP_User_Query and a cron job function reminder_email() { // Get ...
0
votes
0answers
42 views

How to optimize the opening speed of admin panel?

Now my access to the WordPress post editing page is abnormally slow and I have to wait 30 seconds or more for it to finish loading each time. Initially, I thought it was a problem with the network ...
0
votes
0answers
109 views

Effective way to batch update user and meta data

Situation: Large e-commerce store (Woocommerce), with about 12.000 users. That each needs to be assigned a custom user role as a meta data key. Initial approach: Use Action sheduler and set up an ...
0
votes
0answers
52 views

Trying to add current user meta data to a shortcode and display an iframe on Wordpress

I created some custom user meta fields, which I can call normally and display the info added but when I'm trying to pass this meta value on to an iframe to dynamically generate an iframe based on ...
0
votes
1answer
38 views

Random users always showing same 8 users

I am trying to display some random users on the page. It is changing the order of the users it is showing, but it is only showing the same users instead of randomizing from all users in the database. ...
1
vote
0answers
85 views

Four columns in the wp_users table

I am writing custom code to allow users of my site delete their own accounts from the front-end (i.e., they do not have to logon to the WordPress admin area to perform certain actions, but rather I ...
0
votes
1answer
187 views

Display the list of user's comments + the post title + date

I am trying to display the current user's ALL comments in a specific page and I'm using this code (uses a shortcode): https://blog.ashfame.com/2011/01/show-recent-comments-particular-user-wordpress/ ...
0
votes
1answer
259 views

SQL to set Display Name to First Name + Last Name

I'm trying to set the wp_users.display_name for a rather larger users db using SQL query. Got till this point: SELECT x.display_name, x.first_name, x.last_name FROM (SELECT u.display_name, f....
1
vote
0answers
14 views

User Query sort on custom field then name

I am trying to sort a list of attorneys (set up as Users) classified as founding members, members, and associates. Those classifications are stored in the attorney_title meta field. I need them to ...
0
votes
0answers
67 views

Cannot update newly added User field using wp_update_user

I want to add a new attribute to the wp_user table, "twitter_id" for example. I added the new column to the wp_user table, and it is added correctly. I get the current user (as I want to ...
0
votes
0answers
40 views

How to grab data after wp user search is complete

In the wp backend wp-admin > users.php there is a search field which we can use to search for particular users. Let's say we search for a string 'test' and it retrieves 3 users. How can we grab the ...
1
vote
0answers
14 views

how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard

I want to display for the admin when a user visits a page and when he leaves that page the page is for example test.test/my-dashboard. and it's only available for the logged in users. the admin knows ...
0
votes
1answer
1k views

I imported an restore an database and It shows #1067 - Invalid default value for 'user_registered'

My database tables become corrupted so for fixing them I restored data and It shows an error #1067 - Invalid default value for 'user_registered' how can I fix it.
0
votes
0answers
25 views

SQL to join u3g_users & u3g_meta_value with repeating data

I'm using the below SQL to create a table from wordpress user information joining data in u3g_users and u3g_metavalue. SELECT u3g_users.`ID`, u3g_users.`display_name` AS `Name`, ...
1
vote
0answers
33 views

How to show user online status on their posts?

I've tried a lot to solve this but of no use. I have a classified wordpress website where users can post their ads. I want to show their online status on the ad they post (archive and single posts as ...
0
votes
1answer
82 views

Getting user data via ajax

I am trying to list registered users on the frontend which have a role of 'member'. I have a lot of advanced custom fields for the users though and don't know how to get those fields. I installed the '...
0
votes
1answer
125 views

is_user_logged_in() throwing undefined function error

I am running this simple conditional statement on my plugin page: if (! is_user_logged_in()) { add_action('init', 's8w_ajax_login_init'); } It is throwing a fatal undefined function error for ...
0
votes
2answers
90 views

Find count of WordPress users by role and search string for user name

I want to get the total number of results after searching WordPress users by role and a string that matches the user name. What I tried so far: $args= array('echo'=>false, 'role' => 'author', '...
1
vote
2answers
277 views

pagination with numbers for WP_User_Query

I have pagination with next/previous links but I also would like to show numbers so the user can click on 2, 3, 4 etc. Pagination seems more tricky with WP_User_Query as there isn't any default ...
0
votes
2answers
228 views

meta query based on month regardless of year

For each user on my site I store a birthday using ACF date field (stored as YYYYMMDD). Is there a way to construct a meta query to retrive all users that their birthday on that specific month ...
0
votes
2answers
458 views

Display the line breaks in user bio without using html

User fills their user bio using Formidable forms. It saves correctly and displays with line breaks in Worpdress admin on the user overview page. It displays without line breaks on the site. The only ...
0
votes
1answer
78 views

How to display replies to his comments in user profile of current user

How to display list of replies to his comments in user profile of current user. my website can send notification that example: "someone replied to your comment" and when i click the link ...
0
votes
0answers
45 views

How to do WP_User_Query for Nested Array value Inside Nested Array field

i am still new in wordpress development and try to playing with WP_User_Query right now. I have meta field, with this value: array ( 0 => array ( 'address' => array ( '...
0
votes
1answer
178 views

wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow

I want to get the user ID that is currently logged in. I did it successfully when accessed via a web browser. However, when this function is called via dialogflow as webhook / fulfillment it always ...
0
votes
1answer
56 views

How to properly use AND / OR in custom search

I have a text field and a drop down with country names. If I use OR and only fill in the text field with a person's name it brings back incorrect results. If I type in the name and select a country, I ...
2
votes
1answer
223 views

how to create a proper query for getting a list of users with taxonomy related meta key

I want to list user based on the sub category (which is a taxonmy). It displays users from all the sub category rather than the one I select the sub category from the back end. The code is below, ...
1
vote
0answers
33 views

Snippett for create field in registration for users

I have this code that creates a field in the user record, but it is not showing up in the user search. Apparently it seems to be saving or what is entering in the field, but I would like to be able to ...
0
votes
2answers
481 views

meta_query in WP_User_Query not working - returns every user, not just users where key & value matches

I've been going at this issue for hours now, and please save me before i go crazy..... I'm trying to use Wordpress' WP_User_Query to retrieve users from db I've been feeding it with arguments like ...
0
votes
0answers
53 views

Get label in user meta query

So I have a function that creates a mailing list of all users that have a specific user meta key checked using shortcode attributes. The function works well but I can't figure out how to display the ...