First of all, I believe your syntax is incorrect. Should be:
$group = '_mm_group_membership'; // key should be a string
Secondly, did you try using $u->get
? Here’s what the doc says:
If fields is set to all_with_meta, it will return an array of WP_User objects.
So yes, if you specified this parameter you should get a bunch of WP_User
objects back. And yes, there should be a getter in the WP_User
object, but you’d need to feed it that same $group
variable to get the value for your key.
if($u->has_prop( $group )) {
$meta_val = $u->get( $group );
}
Then you work with your value, which, as you mentioned, should be an array (of groups the user is in?). You might need to unserialize it, since WordPress tends to keep things as strings in the database.
Related Posts:
- add_user_meta() vs update_user_meta()
- Get basic Image Uploader on User Profile Page
- Return all users with a specific meta key
- Capabilities Vs User Meta
- Problem storing arrays with update_user_meta
- get_users is expecting unserialized meta_value
- remove user_meta data from database for all users
- How to get user metadata for social media url?
- how to get specific fields from get_user_meta()
- Check if WP_User_Query ‘include’ is empty
- User meta to post
- Add profile field (usermeta) to Add New User
- How to Make admin Sidebar Menu always be Collapse by code
- How to query users by meta value, even when meta key doesn’t exist?
- Add a member number to new user
- Allow role to edit users at lower level with only specific metadata
- Hook or action to save profile fields at specific time
- How to get the user description with get_users?
- get current user not working
- Multiple User-Meta Values in One User-Meta Key
- No first_name or user_firstname property in WP_User object
- Possible bug: update_user_meta is updating two unique meta entries
- Update user meta through a front end form
- How to display current_user bio
- Is a user_meta research case-sensitive or not
- Store user’s registration date as meta
- Can I prevent “wp_user_level” from getting added to wp_usermeta on registration?
- How to tell whether a user meta value has increased or decreased [closed]
- Send mail to user only once when specific check box is selected and updated from profile meta updated by admin
- WP_user_query throws a 404 error
- Incrementally add or substract from usermeta field
- Why get_users() not working on the admin backend?
- Can I set user meta for theoretical user 0?
- strange issue with user_meta + json_encode/decode
- Inserting and finding multiple values in user-meta fields
- Update user meta on logout
- Adding user data to an existing user_id
- I want to update my user meta table
- Problem to wp_hash
- Subscribers Group User meta delete
- action user_new_form param is a string
- Redirecting users based on custom user meta
- Customize Avatar using user meta
- get_user_meta returning old data
- Why does the usermeta table contain html entities?
- How can I programmatically show a specific (template) page, like author.php?
- WP_User_Query not returning users with meta – what am I missing?
- Randomize Users
- Fetch user related data
- “Select your country” landing page. Remember user choice
- How get meta from all users?
- Order By Meta_key but convert custom date to Y-m-d first
- Update user meta without lose of old data
- Using xprofile_insert_field
- Combining wp_list_authors with get_user_meta
- Using WP for user management
- Show extra user profile meta for current user
- Pulling member name from WordPress URL
- Should I have a single cron job that loops the users, or one for each user?
- Save editor’s value in user meta and retrieve it
- WP_Editor not saving data in user_meta
- Remove fields from WordPress profile
- E-mail Update – Validation
- Display Country Flag in Profile WordPress/Buddypress
- How to save a label for an extra user meta field and to display it later?
- Display user meta data from a textarea as a formated text
- gform_after_submission not working as expected [closed]
- Remove user id’s stored in arrays that themselves are stored in user meta of another user
- Sort users by meta key value even if meta key not present for all users
- Wrong result in fetching User meta of WordPress
- Fetch user’s using Last Name
- How to get metadata (in my case mail) of users who have a certain set of metadata?
- How can I search user meta by a partial key name?
- get_user_meta value is stored within strange characters
- Delete user meta ( delete_user_meta ) by key without user id
- Why is my Custom User Meta deleted on Profile Update?
- wp_redirect not working after update_user_meta
- profile_update works on second update only
- How to remove the url format from the WEBSITE field in the user registry?
- users joined group count in buddypress
- Edit a user profile field on front end
- SQL – Shorter way to query user and usermeta data
- WP author meta disappeared
- How to set a user meta key value based on another user meta key value
- Changing an array of IDs in the usermeta table to fit different format
- How to gets users EMAIL by their USERNAME
- Storing data to database and user registration
- Saving an array of values (file urls) to update_user_meta()?
- How to get user meta value in wordpress
- get user role value as a string from wp usermeta table into custom script
- Get currentuserinfo firstname and lastname
- Create a dropdown list displaying users meta data
- Get meta value and associated user meta
- use single form to enter multiple profiles
- Multidimensional array problem with update_post_meta [duplicate]
- Using IDX feed to display agent’s and listings with agent’s info associated for Real Estate Website
- CRM and newsletter integration? [closed]
- Custom user meta data [closed]
- WPML – how to translate user profile fields with icl_t()? [closed]
- Can’t display user bio