• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Display WP Users in Table format filter by Role

markz

Active member
Trusted Uploader
Jun 21, 2019
173
36
28
Hello all, I need help on display Users List on my Page in Table format filter by Role.

Currently I'm using Ultimate Members and it's Member Directory feature only show users in individual Card format. Unable to make it to show in Table format.

Respected expert here please advise, which Plugin or Shortcode I can use to achieve what I need? Please advice, thank you.
 
Last edited:
Hello all, I need help on display Users List on my Page in Table format filter by Role.

Currently I'm using Ultimate Members and it's Member Directory feature only show users in individual Card format. Unable to make it to show in Table format.

Respected expert here please advise, which Plugin or Shortcode I can use to achieve what I need? Please advice, thank you.
Hi mate
  1. Navigate to your CPanel
  2. Navigate to PhpMyAdmin
  3. Then on the left-hand side, find the database that has your WordPress is installed in and select it
  4. Now, on the middle of the screen on the top, find SQL tab, then simply put in the below code:
SQL:
SELECT * FROM TableNaameHere;

An example if I wanted to gather all my registered users would be:
SQL:
SELECT * FROM wpqb_users;

Then to run the code, just hit the "Go" button, located to the center, right side of the page.

You can then highlight/export the result to excel for your needs.

Another unrelated example to give you an idea about how powerful this is, I usually look at all the available tables inside my WordPress database, then I might want to see all the posts in aa table format, I would do the below:
SQL:
SELECT * FROM wpqb_posts;

I hope this answers your question.
 
Hi, thanks for your detail explanation. I guess I need to better explain my use on this.

I use Ultimate Member to control application access level (of course), and I wanted to create a frontend admin access to be able to view users list of certain roles below the admin role.

Just like any web app that admin can view users/members list and can click edit to edit the data.

Your guide have 2 main problem for my usage:

[ 1 ] the data is not real-time for the admin.

[ 2 ] Ultimate Member allow custom register form with custom field, Ultimate Member will handle the custom field their way, similar to ACF I guess. So in the WP USER MySQL table, it doesn't not contain the custom fields.

WPDataTables can work with your way to solve the real-time data for admin cause it make new query when the table load.

But it doesn't solve the custom fields problem. Please advice, thank you.
 
I find it easy to find a plugin to display Custom Post Type, such as WPdataTables.

But I can't find anything for Users with custom fields yet.
 
I find it easy to find a plugin to display Custom Post Type, such as WPdataTables.

But I can't find anything for Users with custom fields yet.
Not sure about the plugins mate, using SQL is much better because you have full power and accessibility, as well as flexibility to display any type of data you need.
 
  • Like
Reactions: markz
@Jano Buddy, can advice on this part? I'm not very familiar with SQL query.

I wanted to try get users data as what you advice, but I need to get link data from "usermeta" table as well.

The relation field is "user_id" on "usermeta" table.

How the MySQL query will look like? Can you give me an example so that I can learn from your example, thanks in advance.
 
@Jano Buddy, can advice on this part? I'm not very familiar with SQL query.

I wanted to try get users data as what you advice, but I need to get link data from "usermeta" table as well.

The relation field is "user_id" on "usermeta" table.

How the MySQL query will look like? Can you give me an example so that I can learn from your example, thanks in advance.
What do you mean... I don't understand what sort of data you're after...
This should show all user data, is that what you're after?
SQL:
SELECT * FROM wpqb_usermeta;
 
Please allow me to explain again.

I have this two table in my WP DB, wp_users and wp_usermeta.

To get the list of users, yes the following query do the job:
SQL:
SELECT * FROM wpqb_usermeta;

But I also need the wp_usermate included in the query result as well. The wp_usermeta include the custom fields I need for users.

I hope this explain better.
 
Please allow me to explain again.

I have this two table in my WP DB, wp_users and wp_usermeta.

To get the list of users, yes the following query do the job:
SQL:
SELECT * FROM wpqb_usermeta;

But I also need the wp_usermate included in the query result as well. The wp_usermeta include the custom fields I need for users.

I hope this explain better.
What is a "wp_usermate" that you refer to?
 
I try the following query but it's not working because of the way usermeta is stored.

SQL:
SELECT * FROM wp_users INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id

For only 2 users in the DB, the above query generate 100 rows of data instead of 2 rows.
 
Found the right SQL Query to get the right result, for anyone who need it, here is the query:

SQL:
SELECT
    u.id,
    u.user_email AS email,
    (select meta_value from wp_usermeta where user_id = u.id and meta_key = 'first_name' limit 1) as first_name,
    (select meta_value from wp_usermeta where user_id = u.id and meta_key = 'last_name' limit 1) as last_name,
    (select meta_value from wp_usermeta where user_id = u.id and meta_key = 'postcode' limit 1) as postcode
FROM wp_users u
 
What is a "wp_usermate" that you refer to?

Sorry that was my typo error. Should be "wp_usermeta".

Now I'm looking for way to filter the result by "role", any tips or hints?
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock