Support » Plugin: WP-Members Membership Plugin » Restrict user to product

  • Resolved MechaWear

    (@mechawear)


    EDIT: I found the function for this at the bottom of the edit user form.
    I suggest adding details about this, here: https://rocketgeek.com/plugins/wp-members/docs/membership-products/

    Looking forward to using this new feature. Thank you.

    Hello
    How do I restrict a registered user to a product?

    For example, if I have 10 pages for course “how to underwater basket weave” and 10 pages for course “teach your turtle to back flip”, how do I ensure that registered and logged in user A can only access “basket…” pages and registered and logged in user B can only access “turtle…” pages?

    Thanks for your help.

    • This topic was modified 1 year, 3 months ago by MechaWear.
Viewing 1 replies (of 1 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    There’s a lot of new stuff in the plugin and documentation is being updated. It’s an ongoing process.

    A product can be assigned to a user manually in their profile (Go to Users > All Users, select the user to edit, and scroll down to “Product Access” (which may end up becoming “Membership Access” I think) and enable or disable as needed.

    For setting product access programmatically, you can use the wpmem_set_user_product() function. This is an API function that can be used in action or filter functions for either WP-Members or any other process that you may want to integrate and automatically set user access. It only needs the product slug and the user ID.

    https://rocketgeek.com/code-snippets/wpmem_set_user_product/

    The opposite of wpmem_set_user_product() is wpmem_remove_user_product(). This will remove a membership from a user.

    https://rocketgeek.com/plugins/wp-members/docs/api-functions/remove_user_product/

Viewing 1 replies (of 1 total)
  • The topic ‘Restrict user to product’ is closed to new replies.