Appearance
app.userHasRole(role)
Checks if the currently logged-in user has the specified role.
Scope: GLOBAL
Parameters
| Parameter | Type | Description |
|---|---|---|
| role | string | Any WordPress role. |
Return Value
| Type | Description |
|---|---|
| true | If the currently logged-in user has the specified role. |
| false | Otherwise. |
✨ Example
js
if (!app.userHasRole("manager")) {
app.setGlobalSearch(false)
app.setColumnFilters(false)
app.setInsert(false)
app.setUpdate(false)
app.setDelete(false)
app.setInlineEditing({
"email": false,
"first_name": true,
"last_name": true,
})
app.setBulkActions({
"pdf": true,
"xml": false,
"delete": false,
})
}Notes
Please be aware that the server will block any rights that surpass the app's configured limitations, even though permissions can be dynamically granted or revoked.
