• Resolved sellyk

    (@sellyk)


    Hi,

    I’m not quite sure how to use the function that you shared in your documentation.

    Lets say I want certain pages to only be visible to those with ‘Plan Bronze’, how do i do this exactly?

    Where do i place this function? How do i edit the function so that its only applicable to certain pages?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter sellyk

    (@sellyk)

    Also, one more thing. I’ve seen that I can grant members certain capabilities, but how can I assign them a role?

    Thanks again.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. usually, it is best to use the Memberships extension with some additional membership plugin which will allow you to go to wp-admin / Pages panel, and select which users (with which capabilities) can see the page.

    If you want to use the current_user_can() function then how and where to do that depends mainly on the theme you are using and what you would like to do, hence the documentation is vague in this part as this is not a one-size-fit-all i am afraid.

    2. The Memberships extension allows assigning capabilities only not roles as the user can have multiple different capabilities but only a single role.

    Thread Starter sellyk

    (@sellyk)

    Hi,

    1. Noted. Is there a membership plugin that you can recommend that works well with the membership add on? ( other than Woocommerce)

    2. Is there a way all users that purchase a membership can automatically be assigned a certain role? For example for for Basic WordPress settings, admin can choose what the New User Role is by default. Is there a way to set it that all wpadvert members are assigned a certain role? Because a lot of plugins i’m finding to help with restricting content,menu’s etc are only offering the feature to restrict by role, not capability. Manually changing all member user roles consistently as they join would be quite tedious.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. i am not really familiar with the Membership plugins.

    2. the only way to do that would be to open file wpadverts-memberships/includes/Capabilities.php and modify this file so instead of using remove_cap() and add_cap() methods it will change user roles.

    Thread Starter sellyk

    (@sellyk)

    Hi,

    1. Okay, no problem

    2. Okay. I’ll try and let you know if i encounter any issues.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to use current_user_can() function – membership’ is closed to new replies.