Conditions
Conditions decide for whom something is active. Where Data Filtering chooses rows, conditions choose whether a View, a layout or a feature shows at all for the person looking.
Conditions only narrow. They never let anyone read a View who could not
otherwise: reading a View needs edit_posts (Contributor and above) unless
it is a public embed, and an Admin
Page needs manage_options.
Building conditions
A Conditions field starts empty, which means always. Each condition compares one parameter with a value:
| Parameter | Group | Compares |
|---|---|---|
| Admin area | Environment | Whether the View is shown in wp-admin, on a post list or an admin page, rather than in a shortcode embed |
| User | User | The current user, chosen from the site’s users |
| User role | User | The current user’s primary role |
The operator is is equal to or is not equal to. For Admin area, is equal to means in wp-admin and is not equal to means in an embed. Negate turns a condition around: it holds when the comparison does not.
Conditions are grouped like data filters: all conditions in a group must hold (AND), and the field is satisfied when any one group holds (OR).
Where conditions apply
A View
Conditions in View settings:
- On its post type’s list screen, a View whose conditions fail leaves WordPress’s standard list in place.
- On an admin page and in a shortcode embed, the View is left out.
A layout
Each layout’s Conditions section hides its tab from users the conditions exclude, wherever the View renders. The editor’s preview applies them to you, so a layout hidden from you shows the message “This View is hidden by its conditions.”
A switch
Most switches in a layout’s settings, such as Show search, Allow data export, Show upvotes or Show edit button, get their own conditions once they are turned on. When the conditions fail, the switch counts as off for that user. A board can, for example, allow editing only for administrators while everyone else sees it read-only. The server holds every change made through a placed View to the same switches: a card moved on a board without Allow sorting, or an item added where the add button is hidden, is refused.
An admin page
An admin page‘s Conditions decide whether its menu page is registered for the current administrator at all.
How conditions are decided
On a post list, an admin page and in an embed, SleekView decides the conditions on the server for the user loading the page. An embed passes the facts of the page it sits on, so Admin area is false there. Results are not shared between users, so a page cache that stores the embed’s page stays correct.
Examples
- Editing only in wp-admin: on a Kanban layout’s Show edit button, add Admin area is equal to.
- A layout for editors: on the layout’s Conditions, add User role is equal to Editor.
- Administrators in wp-admin only: one group with two conditions, Is Admin is equal to and User role is equal to Administrator.
- Everyone except one user: User is not equal to that user.