Change WordPress user roles and capabilities Forums Bug Reports “no role for this site” & [user_role_editor roles=”none”]

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #7746
    TWarrior
    Participant

    Hello,

    I have users with no role (“no role for this site”)

    The shortcode:
    [user_role_editor roles=”none”]You dont have a role[/user_role_editor]
    doesnt work for those users without role.

    Yes, I know that roles=”none” is only for not logged users, but the expected behaviour would be to include also users with “no role for this site”.

    Thanks

    #7748
    Vladimir
    Keymaster

    Hi,

    I confirm that currently role=”none” works for the not logged-in users only – traditionally, from very begin.
    From one side, registered user without role can easily get access to the content with roles=”none”, it’s enough just logout. But, many sites use this shortcode to show content for not logged-in users only, to invite to login, for example. It will be not correct to show such content for logged-in users, which does not have role at the site. Backward compatibility is very important.

    What if to add something like ‘none_for_logged_in’, which will work especially for logged-in users, which does not have role for this site? Finally, it will be possible to user shortcode with parameters like roles=”none none_for_logged_in” especially for your case.

    #7749
    TWarrior
    Participant

    thank you very much for your kind and quick response. It is a pleasure to be attended by the responsible of this great plugin.

    Forgive me, but I don’t quite understand your answer.

    I take this opportunity to explain my need (and I suppose that of many others who use “no role for this site”).

    Traditionally, we used to show content only for active members (with any role such as administrator, editor, subscriber…) of the NGO with this code:

    [user_role_editor roles=”none”]Please join our NGO, or loggin (text for non logged-in or not members yet)[/user_role_editor]
    [user_role_editor except_roles=”none”]Some text only for NGO active members with any rol[/user_role_editor]

    But now we have members who have temporarily unsubscribed. We don’t want to delete their user accounts, so we thought that assigning them to “No role for this site” might be a solution.

    So we would like these people without a role, even if they are logged in, not to be able to see content that is only for members with a role.

    I understand the importance of backwards compatibility, but it is very strange that “role=none” actually means “role=logged_out”, and also there is no “role=no_role” to handle non-role users…

    Let me humbly make you a proposal:
    Add the value “role=no_role” to handle users with “no role on this site”.

    I think this way we could use the following code to display restricted content only for members with an assigned role:

    [user_role_editor roles=”none,no_role”]Please join our NGO, or loggin (text for non logged-in or logged with “no role for this site”).[/user_role_editor]
    [user_role_editor except_roles=”none,no_role”]Some text only for NGO active members with any rol[/user_role_editor]

    What is your opinion? Could it work?

    #7763
    TWarrior
    Participant

    hello.
    Just to make sure this is not forgotten. any news on this issue? any further clarification or explanation needed?
    Thanks

    #7765
    Vladimir
    Keymaster

    Hi,

    Excuse for so huge delay with response. Yes, it will work. ‘no_role’ seems more nice for me. I will provide access to the beta for testing until the end of November, 2021.

    #7766
    TWarrior
    Participant

    Thank you

    #7768
    Vladimir
    Keymaster

    Try development version 4.61.b1. It’s available from the “Download” page after login.

    #7771
    TWarrior
    Participant

    Thanks.
    Tested with this code:

    TEST 1. roles=”none” for a user NOT LOGGED-IN:
    RESULT: [user_role_editor roles=”none”]you are NOT LOGGED-IN[/user_role_editor]
    [user_role_editor except_roles=”none”]you are LOGGED-IN[/user_role_editor]

    TEST 2. roles=”no_role” for a user with NO-ROLE-FOR-SITE (or not logged-in):
    RESULT: [user_role_editor roles=”no_role”]your profile is NO-ROLE-FOR-SITE (or you are not logged-in)[/user_role_editor]
    [user_role_editor except_roles=”no_role”]your profile is any, except NO-ROLE-FOR-SITE[/user_role_editor]

    WORKS PERFECT!

    if you want to update

    Shortcode for content view access restriction


    I have wrote this:
    If you wish to show some content for users with no role (“— No role for this site —”) or not logged in, use this shortcode [user_role_editor roles=”no_role”].

    #7772
    Vladimir
    Keymaster

    Thanks for the help.

    #7776
    TWarrior
    Participant

    Thanks to you for this multi propouse pluging.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.