• Resolved cyanidemedia

    (@cyanidemedia)


    Hi,

    I’m working on a site where I’d like a user generated post to become blocked if the user cancels their membership. The post is public facing and not behind the restricted content.

    I’m planning to write the php to do this myself, im just not sure what to call from the pmpro side in order to check if the user has an active membership on the site.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @cyanidemedia,

    Thanks for using Paid Memberships Pro. We don’t have a snippet to do this outside of using the Paid Memberships Pro plugin. If you want to get an idea of how Paid Memberships Pro is coded, you can do so here and then write something up.

    Kind regards,
    Michael

    Thread Starter cyanidemedia

    (@cyanidemedia)

    Hey Michael,

    Thanks I appreciate it. Mostly what i was looking for is how to check that a user has an active membership. I found this snippet in one of the plugin files. Would this do it?

    if($current_user->ID)
    $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);

    That appears like it should work, but you will need to test it.

    Because there have not been any recent updates to this topic we will be changing the status to resolved. If you have any further questions you can start a new thread, or head over to our member support area if you’re a paying member or your request is regarding a plugin distributed through our website or GitHub.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to check if a user has an active membership in Php’ is closed to new replies.