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. 🙂
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).
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?
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.
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 4 years, 2 months ago by
Aldo Latino. Reason: typo
Yes Aldo, it definitely works as expected! Thank you very much!
Great! I will officially release the new version in the next upcoming days.
May I ask you to leave a review here?
Thanks.
The new 6.5.0 version has just been released. Enjoy! 🙂
Thank you so much Aldo! I already left a five star review a few months ago, I just edited the text right now.