• Resolved jeff98

    (@jeff98)


    Hi there,

    Sorry to bother you, I encounter an issue configuring restrictions with the plugin.

    I created several roles and would like to forbid access to some of them. The problem I encounter is that unlogged in customers cannot access the articles I restrict… I do not have a role “guest” or “unsigned in” “unregistered” or else that could be checked to allow them to access the content…

    Is it normal not to have the “guest” role (could I have deleted it earlier ? I feel like it would be the same as customers and admin, roles I cannot delete). If the role does not exists, is it possible to create a role that would concerne every unsigned users (guests), even if I let the default role on customer for people creating an account…

    I hope that my question is clear, do not hesitate to ask me if you need any other information.

    Thanks in advance for any help you could give me, and best regards !

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi @jeff98

    WordPress doesn’t add any role to users who are not logged-in, so there is no Guest role. You can check if user is logged-in in your code like this:

    if ( is_user_logged_in() ) {
      echo 'Welcome, registered user!';
    } else {
      echo 'Welcome, visitor!';
    }

    or create a shortcode similar to this one: https://paulund.co.uk/display-text-to-only-logged-in-wordpress-users

    Best

    Thread Starter jeff98

    (@jeff98)

    Thank you very much for your reply. This means that I cannot configure some products to be seen by guests that are not logged in yet ? I mean, I would like some pages or products to be hidden only to selected roles, but visible for guests…

    Thanks again for your help, best regards !

    Plugin Author Caseproof

    (@caseproof)

    Members is based on user roles so you cannot configure it in Role Manager, but you can use the code snippets I sent you to modify your templates or plugin files. Unfortunately, it requires custom development.

    Best

    Thread Starter jeff98

    (@jeff98)

    Thank you very much, I will have a look at it. I thought that the code would only display a texte message to logged customers or else… I probably did not give enough attention to it. I let the conversation opened and will confirm here as soon as I solved the problem so this could help future customers.

    Plugin Author Caseproof

    (@caseproof)

    Please not that Members has also shortcode to display content based on log in status so you can display content for not-logged-in users like this:

    [members_not_logged_in]This content is only shown to logged-out visitors.[/members_not_logged_in]

    However, to use it in the PHP file it’s better to use is_user_logged_in function I mentioned before.

    I hope that helps.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unregistered customers restrictions’ is closed to new replies.