Show or hide any portion of post content based on usernames, user roles, capabilities, custom groups, or logged-in status. Construct shortcodes manually or using a point and click UI.
Mini Update Log
- v1.7 added multisite support for username multiselect; fixed bug with role/level dropdown in non-Mozilla browsers.
- Lots of new features in v1.6, including smooth integration with Role Scoper and Press Permit, thanks to their author Kevin Behrens, who has also now joined the Eyes Only team. Two makes a team, right?
- As of v1.5, has compatibility with BuddyPress and BBPress forums in conjunction with the bbPress2 shortcode whitelist plugin by Anton Channing.
- As of v1.4, includes TinyMCE Shortcode Button with Shortcode Generator Modal, with options to restrict access to the Shortcode Button, and to determine its position on the TinyMCE panel.
- As of v1.3, includes Options page, with options to restrict access to the Meta Box, and to prevent content being hidden from Administrators.
- As of v1.2, includes Shortcode Generator Meta Box
- See full changelog
- Required attributes: either logged="in|out" or level="anyrole, any_capability" or username="anyusername" or all three
- Newly integrated attributes: rs_group="any_Role_Scoper_group(s)" or pp_group="any_Permit_Press_group(s)"
- Optional attribute: hide="yes"
All shortcodes must include at least one of the three required attributes. In some cases, it makes sense to use all of them together.
- The 'logged' attribute takes one of two values: 'in' or 'out'
- The 'level' attribute takes any user role (including custom roles) or any capability (including custom capabilities). It can take multiple roles and/or capabilities, separated either by spaces or commas.
- The 'username' attribute takes any userlogin (username), or multiple, separated either by spaces or commas.
- The 'rs_group' and 'pp_group' attributes can take comma or space-separated lists just like the 'level' and 'username' attributes. If you have the latest versions of either Role Scoper or Press Permit activated, you'll get an extra menu in your shortcode generators to filter your content by those custom user groups. This attribute can also be used in combination with any of the others to fine tune your filtering.
- The 'hide' attribute: By default, the shortcode will show the content only to the users specified by the 'username', 'level' or 'logged' attributes. Adding the 'hide' attribute will reverse that, and hide the content from the specified users. To hide content from the specified users, use hide=yes or hide=true.
Any other shortcode can be used inside this shortcode.
[eyesonly level="administrator, customrole, moderate_comments"] Any kind of content. [/eyesonly]
This will show the content only to users with the 'administrator' role, the 'customrole' role, and the 'moderate_comments' capability.
[eyesonly hide="yes" logged="out" level="subscriber customrole"] Any kind of content. [/eyesonly]
This will hide the content from all logged out users, and from anyone with the roles 'subscriber' or 'customrole'.
[eyesonly username="joebob, billyjean" level="administrator"] Your content. [/eyesonly]
This will show the content to all administrators and to the specific users 'joebob' and 'billyjean,' whether they're administrators or not.
[eyesonly logged="in"] Content for logged-in users. [/eyesonly][eyesonly logged="out"] Content for logged-out users. [/eyesonly]
This will show different content in the same location on the page depending on a user's logged-in or out status.
[eyesonly level="administrator"] Content. [/eyesonly]
This will show the content only to administrators.
[eyesonly hide="yes" level="administrator custom_capability"] Content. [/eyesonly]
This will hide the content only from administrators and from any role that has the 'custom_capability'.