• Resolved agenziae20

    (@agenziae20)


    Hello Aldo,
    since your plugin works great on restricting content based on user roles OR based on the fact that a user is also the post author…
    could you please also add a new feature so that it can be restricted based on the POST AUTHOR’s USER ROLE?
    I mean the hidden content should be visible to anybody ONLY IF the post author belongs to a specific user role.
    So, for example, if the author of this post is an Administrator, then show the hidden text to every user/visitor of that post. Something like
    [private role=”post-author-administrator”]Text for everybody[/private]

    Basically it works as default but checks the post author’s user role instead of the current user’s role.

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

    (@aldolat)

    Hello!

    So, if the post author is an administrator, everybody can read the hidden text, right? And, if the post author is an editor (for example), who can read the hidden text? We should define a map of authors’ roles and target user.

    I am not sure if I have correctly understood your post. ??

    Thread Starter agenziae20

    (@agenziae20)

    The hidden text is displayed to EVERYBODY only if the POST AUTHOR belongs to a defined user role.

    I have a block of content which will be filled with Products, but only users with Vendor role can add Products to their page.
    So I need to display this block only if the author is a Vendor, otherwise the block will be displayed with a title and some text but there is no real content (Products).

    Plugin Author Aldo Latino

    (@aldolat)

    I don’t think that Private Content is the right plugin. It has been designed to hide a small portion of simple text to certain users. My advice is to find a more complex plugin. Perhaps Members?

    Thread Starter agenziae20

    (@agenziae20)

    Actually I just need to hide a title and a small shortcode that displays products, so it is just a very short content. I thought that your plugin was a good choice because it works in a very similar way.

    Now the basic rule is:
    always hide “this text” except if CURRENT USER has a certain role

    I need it to be modified into:
    always hide “this text” except if the POST AUTHOR has a certain role (current user role is irrelevant, he could be any role or also a visitor)

    So it could be something like:
    [private role=”custom-author” custom_role=”vendor”]Hi everybody, I am a Vendor.[/private]

    Since you already introduced the “post-author” & “post-author-only” rules, I thought this would have been a minimal upgrade.

    Plugin Author Aldo Latino

    (@aldolat)

    I just added the new option post-author-custom to be used along with custom_role option.

    For example:

    [private role="post-author-custom" custom_role="marketing" alt="Alternate text."]Hidden text.[/private]

    Replace marketing with one of your roles.

    The hidden text will be publicly shown if the author of the post has the role defined in custom_role.

    The new option is not yet released to the public, but you can download it from here for testing purposes:
    https://github.com/aldolat/private-content/archive/refs/heads/develop.zip

    Decompress the file and replace only the file private-content-develop/includes/class-ubn-private.php. The other files are unchanged.

    Please test it and tell me if all works as expected.

    Please, let me know.

    • This reply was modified 2 years, 8 months ago by Aldo Latino. Reason: typo
    Thread Starter agenziae20

    (@agenziae20)

    Yes Aldo, it definitely works as expected! Thank you very much!

    Plugin Author Aldo Latino

    (@aldolat)

    Great! I will officially release the new version in the next upcoming days.

    May I ask you to leave a review here?

    Thanks.

    Plugin Author Aldo Latino

    (@aldolat)

    The new 6.5.0 version has just been released. Enjoy! ??

    Thread Starter agenziae20

    (@agenziae20)

    Thank you so much Aldo! I already left a five star review a few months ago, I just edited the text right now.

    Plugin Author Aldo Latino

    (@aldolat)

    Thank you! ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘post author’s user role’ is closed to new replies.