• Hi there, great plugin btw!

    The only problem is that it won’t work with custom user roles created with the WP Plugin “User Role Editor“.

    I’ve created custom roles one called “importer” and one “exporter” with the role editor plugin above.

    Then I just want to show text for those 2 user roles (importer, exporter) and for all other users AND non-logged-in users just a simple text with a link.

    So the shortcode would be:
    [private role="importer, exporter" alt="<a href='https://www.test.de/'>Nothing to see here, bro!</a>"]TROLOLOLOLOLOLOLOL[/private]

    But this constellation isn’t working at all!
    Do you have a workaround for this?

    Just adding the user names (with that specific roles) doesn’t work because I have over 1,000 users so far and it’s increasing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aldo Latino

    (@aldolat)

    Hi,
    I already explained how to use this plugin with custom user roles, see here.

    If anything is not clear, please tell me here.

    Thread Starter AnimeSubways

    (@animesubways)

    Yes, I have two use cases and three custom roles called “patient”, “apotheke” and “importeur”.

    – patient = Read_ubn_editor_notes = editor_only
    – apotheke = Read_ubn_contributor_notes = contributor_only
    – importeur = Read_ubn_author_notes = author_only

    – patient only has capabilites of Read_ubn_editor_notes
    – apotheke has capabilites of Read_ubn_editor_notes and Read_ubn_contributor_notes
    – importeur has capabilites of Read_ubn_editor_notes, Read_ubn_contributor_notes and Read_ubn_author_notes

    THE USE CASES – on different pages (not the same):
    Value 1 should be seen by patient, apotheke and importeur.
    Value 2 should only be seen by apotheke and importeur (not patient).

    But this shortcode isn’t working:

    [private role="contributor-only, editor-only, author-only" alt="<a href='https://www.test.de/' target='_blank'>Nothing to see here.</a>"]<strong><span style="color:red;">The value...</span></strong>[/private]

    What I’m doing wrong?

    • This reply was modified 7 years, 6 months ago by AnimeSubways.
    • This reply was modified 7 years, 6 months ago by AnimeSubways.
    • This reply was modified 7 years, 6 months ago by AnimeSubways.
    • This reply was modified 7 years, 6 months ago by AnimeSubways.
    Plugin Author Aldo Latino

    (@aldolat)

    You can’t use multiple roles in a single shortcode, but only one.

    In your case, try this:

    Value 1 should be seen by patient, apotheke and importeur.

    Since patient, apotheke and importeur share the same read_ubn_editor_notes capability, these roles will read this shortcode:

    [private role="editor-only"]Text for patient, apotheke and importeur[/private]

    Value 2 should only be seen by apotheke and importeur (not patient).

    Since apotheke and importeur share the same read_ubn_contributor_notes capability, these roles will read this shortcode (excluding patient which has not this capability):

    [private role="contributor-only"]Text for apotheke and importeur[/private]

    In order to test if these shortcodes are working as intended, you can use the plugin User Switching, which enables you to temporarily test what a particular user can do and view.

    Please, let me know.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin not working with custom user roles using User Role Editor?’ is closed to new replies.