Support » Plugin: Paid Memberships Pro » [Plugin: Paid Memberships Pro] Getting user's membership level

  • I’m trying to add the user’s membership level to the posts table for quick reference for editors. Basically the workflow of the site is that all users can post drafts, but editors only publish posts for users that have a particular membership level. Rather than having editors click back and forth between the membership list (which I’d rather not reveal to editors to begin with) and the posts list, I’d like to have the user’s membership level as one of the fields in that list. I have added the column, but am struggling at hooking into the post’s user’s membership level. I’m looking through your sql query you use on your membership list and, I suppose I could do a similar query, but rather than have that query run for each post in the loop (very server intensive), I’d rather be able to grab the membership level from get_the_author_meta(). Is that possible? Any help is greatly appreciated! 🙂

Viewing 1 replies (of 1 total)
  • Plugin Author Jason Coleman


    I’m a little lost Re what you are trying to do. The relationship between a user and their membership level is only stored in the pmpro_memberships_users table in the DB. (Not in the user meta.)

    Look in the includes/functions.php file of the plugin for the pmpro_getMembershipLevelForUser function. You will still be making one query for each user. It’s possible you could update the user query to join on the pmpro_memberships_users table to save queries.

    Devising some way to mirror the membership level id in the user meta along with the table might be useful as well.

    btw, this is the type of question we prefer to answer in the PMPro Member support forums:

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Paid Memberships Pro] Getting user's membership level’ is closed to new replies.