Access users who are not part of a membership

Hi, I have a problem with the user access to the site.

The user who accesses the site with the credentials to access the administrative area, is redirected to the 2 Pro Membership page to another category of members, which then reads this: Protected Content. The content you are trying to access is only available to members. Sorry.

How I can do to make access directly to some person in the administration and does not redirect to the page you create with the plugin?

  • Bojan Radonic

    Hey there Iacopo,

    How are you doing today?

    I'm not exactly sure I understand the issue completely. The users you're mentioning are supposed to access your WP Dashboard but they are not being able to? Or the issue is that they are not having access to some of the content on the front end that is protected by one of the memberships?

    For protected content part, only users that have WordPress user role "Administrator" have access to all protected content regardless of membership so there is no other way for this users if they are not site admins (with the role I mentioned above) to access that protected content unless you assign those memberships to them.

    As for logging options all users are being redirected Account page unless "Redirect Control" addon is being used that allows you to redirect users to different page on login or log out. This will affect all users aside from users with WP user role "Administrator". Other users can still go into admin by adding /wp-admin/ to the URL once they are logged in or if you enable admin bar for all users in Membership 2 -> Settings -> General, see screenshot

    users will be able to do that from the admin bar.

    Hope this helps :slight_smile:

    Cheers,
    Bojan

  • Ash

    Hello Iacopo

    Please try the following code: https://gist.github.com/bappi-d-great/dea359b7b3d8921d8253641cd08e17b0

    You need to change $redirect_url and $membership_id variable value at line 22 and 23.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash