Setup list of members by meta key
-
Hi there,
I like to setup a list of users who are part of a company (company_name is the custom meta key) when people register.
I think i have to do this through member directories right? Well i can’t seem to find where and how to create these. I don’t have that option in the backend menu.
Would like to have some advice.
Screenshots below:
https://ibb.co/Yf0jqct
https://ibb.co/jkJxM5pThank you,
Remy
-
Thank you for contacting our support.
It appears you’re using an older version of UM and WP. Could you please share the versions here?
Regards,
Hmm that would be strange. All my plugins are up-to-date when I check the backend of the website
here is my information:
### Begin Install Info ### ## Please include this information when posting support requests ## --- Site Info --- Site URL: https://plateau.ar Home URL: https://plateau.ar Multisite: No --- Hosting Provider --- Host: DBH: localhost, SRV: plateau.ar --- User Browser --- Platform: Apple Browser Name: Chrome Browser Version: 105.0.0.0 User Agent String: Mozilla/5.0 (Macintosh; Intel Ma c OS X 10_15_7) AppleWebKit/537. 36 (KHTML, like Gecko) Chrome/10 5.0.0.0 Safari/537.36 ---- Current User Details -- Role: administrator --- WordPress Configurations --- Version: 6.0.2 Language: nl_BE Permalink Structure: /%postname%/ Active Theme: Betheme Child 2.0 Page On Front: Top (#56) Page For Posts: (#0) ABSPATH: /var/www/html/ All Posts/Pages: 0 WP Remote Post: wp_remote_post() works WP_DEBUG: Disabled WP Table Prefix: Length: 3, Status: Acceptable Memory Limit: 40MB --- UM Configurations --- Version: 2.5.0 Upgraded From: 2.5.0 Current URL Method: Cache User Profile: Yes Generate Slugs on Directories: Yes Force UTF-8 Encoding: No JS/CSS Compression: No Port Forwarding in URL: No Exclude CSS/JS on Home: No --- UM Pages Configuration --- User: https://plateau.ar/gebruiker/ Account: https://plateau.ar/account/ Members: https://plateau.ar/leden/ Register: https://plateau.ar/registreren/ Login: https://plateau.ar/login/ Logout: https://plateau.ar/uitloggen/ Password Reset: https://plateau.ar/wachtwoord-herstellen/ --- UM Users Configuration --- Default New User Role: subscriber Profile Permalink Base: user_login User Display Name: full_name Force Name to Uppercase: No Redirect author to profile: No Enable Members Directory: No Use Gravatars: No Require a strong password: On --- UM Access Configuration --- Panic Key: Global Site Access: Site accessible to Logged In Users Custom Redirect URL: https://plateau.ar Exclude the following URLs: Backend Login Screen for Guests: No Redirect to alternative login page: Backend Register Screen for Guests: No Redirect to alternative register page: Access Control widget for Admins only: No Enable the Reset Password Limit: Yes Reset Password Limit: 3Disable Reset Password Limit for Admins: No Blacklist Words: 5 --- UM Email Configurations --- Mail appears from: Plateau Mail appears from address: [email protected] Use HTML for E-mails: Yes Account Welcome Email: Yes Account Activation Email: Yes Pending Review Email: Yes Account Approved Email: Yes Account Rejected Email: No Account Deactivated Email: No Account Deleted Email: No Password Reset Email: Yes Password Changed Email: Yes --- UM Total Users --- All Users(3) administrator(1) subscriber(2) none(0) --- UM Roles --- Administrator (administrator) Editor (editor) Author (author) Contributor (contributor) Subscriber (subscriber) Customer (customer) Shop manager (shop_manager) --- UM Custom Templates --- N/A --- UM Email HTML Templates --- N/A --- Web Server Configurations --- PHP Version: 7.4.30 MySQL Version: 5.7.38 Web Server Info: Apache --- PHP Configurations --- PHP Memory Limit: 256M PHP Upload Max Size: 100M PHP Post Max Size: 100M PHP Upload Max Filesize: 100M PHP Time Limit: 120 PHP Max Input Vars: 1000 PHP Arg Separator: & PHP Allow URL File Open: Yes --- Web Server Extensions/Modules --- DISPLAY ERRORS: N/A FSOCKOPEN: Your server supports fsockopen. cURL: Your server supports cURL. SOAP Client: Your server does not have the SOAP Client enabled. SUHOSIN: Your server does not have SUHOSIN installed. GD Library: PHP GD library is installed on your web server. Mail: PHP mail function exist on your web server. Exif: PHP Exif library is installed on your web server. --- Session Configurations --- Session: Disabled Session Name: PHPSESSID Cookie Path: / Save Path: /var/lib/php/sessions Use Cookies: On Use Only Cookies: On --- WordPress Active Plugins --- Admin Color Schemes: 3.0.0 Adminimize: 1.11.8 All-in-One WP Migration: 7.65 Checkout Fields Manager for WooCommerce: 6.2.8 Code Manager: 1.0.18 Contact Form 7: 5.6.3 Contact Form 7 - Dynamic Text Extension: 2.0.3 Contact Form 7 Database Lite: 3.0.3 Custom Validation Message for Contact Form 7: 2.0.0 Direct Checkout for WooCommerce: 2.6.9 Drag and Drop Multiple File Upload PRO - Contact Form 7: 5.0.6 Easy WP SMTP: 1.4.7 File Renaming on upload: 2.5.0 Force Regenerate Thumbnails: 2.0.6 Hide Admin Bar From Non-Admins: 1.0.1 JSM's Force HTTP to HTTPS: 3.4.1 Manage Notification E-mails: 1.8.3 Send PDF for Contact Form 7: 0.9.8 Site Kit by Google: 1.84.0 Ultimate Member: 2.5.0 WooCommerce: 6.9.4 WooCommerce Payments: 4.8.0 WP Data Access Premium: 5.2.6 Yoast Duplicate Post: 4.5 ### End Install Info ###
Thanks for providing the installation info. I can see that you have the latest versions.
Have you tried deactivating other plugins and then leaving UM plugin active just to test this issue? Let’s see if the Member Directory menu still doesn’t show.
Regards,
thx for helping out, unfortunately deactivating all plugins did not make any difference. I’ve also tried to use the twenty two theme as my main theme is “BeTheme” but that also didn’t make a differences.
Are there any other options to try in order to get the Member Directory to work?
Have you enabled Member Directory in:
UM Settings -> General -> Users -> Enable Members Directory
Wauw! oke that was it, thank you for pointing out that setting to me. I totally overlooked it somehow! -,-
By default, Ultimate Member will install a members directory on your site on a page called members.
https://docs.ultimatemember.com/article/1723-displaying-member-directories
You have to enable this UM default feature.
Can you make a step 0 in this guide about how to enable Member Directory.
So i’ve checked out the settings but i’m in doubt if it’s possible to create custom directories based on a custom meta-key.
I want to create a per company list/grid using a custom meta-key.
My custom meta-key is called “company_name”. Users will add their company during signup.Is it possible to create a list based on a dynamic meta-key?
Thank you.
I’m not sure that’s possible without a code snippet.
You can try this code snippet where users get a Member Directory only with their own company members listed. If
company_name
is empty only a Member Directory with current user.Change
$directory_id = '387';
to your Member Directory ID.Install the code snippet into your active theme’s functions.php file
or use the “Code Snippets” plugin.https://www.ads-software.com/plugins/code-snippets/
add_filter( 'um_prepare_user_query_args', 'custom_meta_value_prepare_user_query_args', 10, 2 ); function custom_meta_value_prepare_user_query_args( $query_args, $directory_data ) { $directory_id = '387'; $meta_key = 'company_name'; if( $directory_data['form_id'] == $directory_id ) { $meta_value = um_user( $meta_key ); $include = array( um_profile_id() ); if( $meta_value ) { $include = get_users( array( 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'fields' => 'user_id', )); } $query_args['include'] = $include; } return $query_args; }
Thank you for your help. That indeed works great!
Appreciate it!
Thanks for tagging me. The doc has been updated!
Displaying Member Directories
https://docs.ultimatemember.com/article/1723-displaying-member-directories
- The topic ‘Setup list of members by meta key’ is closed to new replies.