Support » Plugin: WordPress Membership Plugin - Restrict Content » Not able to get restriction in our plugin.

  • Resolved masihurrahman

    (@masihurrahman)


    Hi There,

    I am a developer and got an issue to conflict your plugin with my plugin. I have created a website, installed your plugin for content restriction. Also, I have used my plugin (Website Toolbox: https://wordpress.org/plugins/website-toolbox-forums/) on my website for SSO (Single Sign On). I have faced an issue in the SSO after restricted the content using your plugin. I have installed the Website Toolbox plugin then it automatically created a page on my website and I restricted the page content using your plugin for registered users. But, when I log in to the website as a registered users (who’s access have been restricted to the website toolbox page using your plugin), he logs in to the website toolbox forum via our SSO (using our plugins).

    Could you please advise that what approach should we apply on our plugin, so that we should know if the user( who is logged in on the website) has access to the Website Toolbox forum page or not.

    Please confirm if you are using any hook for the same? If yes, Please provide us the hook name which you are using to restrict the user so that we can make a change in our plugin as well.

Viewing 1 replies (of 1 total)
  • Plugin Author Ashley

    (@nosegraze)

    Restrictions are done using WordPress roles and capabilities. See here: https://codex.wordpress.org/Roles_and_Capabilities If you have a user ID number you can check if someone has the role you’ve selected with the user_can() function: https://codex.wordpress.org/Function_Reference/user_can

    So if you’ve restricted content to “Subscriber”, you can check if they have the subscriber role or you can check if they have one of the subscriber’s capabilities (such as user_can( $user_id, 'read' )).

    You can see how we’ve done it in the file includes/user-checks.php

Viewing 1 replies (of 1 total)
  • The topic ‘Not able to get restriction in our plugin.’ is closed to new replies.