Gets the memberships the user has.
integer(optional) User ID to retrieve memberships for, defaults to the current user is no user id is passed.
An array of the user’s memberships keyed by the membership product’s slug. Array will include any memberships that have been enabled for the user.
If the membership is an expiration product, the value will be a timestamp (epoch time) of the user’s expiration date. If checking for access, use wpmem_user_is_expired() or wpmem_user_has_access() as these will check if the expiration date is past.
If the membership is not an expiration product, the value will be “1”.
Memberships not enabled will not be in the array.
- Introduced in 3.2.0
- 3.2.6 updated to return empty array if no memberships exist for this user
- 3.3.0 udpated to use individual meta for product access
wpmem_get_user_products() is located in /includes/api/api-users.php.