0

I'm trying to write PHP code that loops through all WordPress users and fetches information out of their Ultimate Member profile. Looping through all WP users is the easy part and I have that covered.

The Ultimate Member codex provides a um_user() function to fetch the currently logged in user, and a um_fetch_user() function for retrieving a UM user given an Ultimate Member user ID, but I can't find any way to determine a user's UM ID based on their WordPress ID: neither the WP user profile nor the WP meta seem to contain a UM user ID.

How can I retrieve a UM user record if I only have its WordPress user ID? Alternately, how can I retrieve UM user data for all users?

1 Answer 1

0

You can fetch the Ultimate Member user information using um_fetch_user() function.

// Get the user ID
$user_id = 4;

// Fetch user data for the current profile
um_fetch_user($user_id);

// Retrieve data of any field. example field "band"
$field_data= um_user('band');
2
  • This doesn't answer the question of how to determine a user's UM ID based on their WordPress ID.
    – kmoser
    Commented Sep 26, 2023 at 4:25
  • UM ID and WordPress User ID is same. Since Ultimate Member uses the native WordPress user mechanism. Check the set() method of User Class for more details. UM User Class
    – Asif
    Commented Sep 26, 2023 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.