GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
GravityView Roles Class. More...
Public Member Functions | |
__construct () | |
Get things going. More... | |
add_caps () | |
Add capabilities to their respective roles if they don't already exist This could be simpler, but the goal is speed. More... | |
filter_user_has_cap ( $usercaps=array(), $caps=array(), $args=array(), $user=NULL) | |
Add support for gravityview_full_access capability, and. More... | |
members_register_cap_group () | |
Add GravityView group to Members 1.x plugin management screen. More... | |
remove_caps () | |
Remove all GravityView caps_to_check from all roles. More... | |
Static Public Member Functions | |
static | all_caps ( $single_role=false, $flat_array=true) |
Get an array of GravityView capabilities. More... | |
static | get_instance () |
static | has_cap ( $caps_to_check='', $object_id=null, $user_id=null) |
Check whether the current user has a capability. More... | |
static | maybe_add_full_access_caps ( $caps_to_check=array()) |
Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against. More... | |
static | merge_with_all_caps ( $caps) |
Merge capabilities array with GravityView capabilities. More... | |
Static Public Attributes | |
static | $instance = null |
Private Member Functions | |
add_gravity_forms_usercaps_to_gravityview_caps ( $usercaps) | |
If a user has been assigned custom capabilities for Gravity Forms, but they haven't been assigned similar abilities in GravityView yet, we give temporary access to the permissions, until they're set. More... | |
add_hooks () | |
wp_roles () | |
Retrieves the global WP_Roles instance and instantiates it if necessary. More... | |
GravityView Roles Class.
This class handles the role creation and assignment of capabilities for those roles.
Definition at line 23 of file class-gravityview-roles-capabilities.php.
__construct | ( | ) |
Get things going.
Definition at line 48 of file class-gravityview-roles-capabilities.php.
References add_hooks().
add_caps | ( | ) |
Add capabilities to their respective roles if they don't already exist This could be simpler, but the goal is speed.
When $use_db is true, add_cap() performs update_option() every time. We disable updating the database here, then re-enable it below.
Update the option, as it does in add_cap when $use_db is true
Restore previous $use_db setting
Definition at line 196 of file class-gravityview-roles-capabilities.php.
References wp_roles().
|
private |
If a user has been assigned custom capabilities for Gravity Forms, but they haven't been assigned similar abilities in GravityView yet, we give temporary access to the permissions, until they're set.
This is for custom roles that GravityView_Roles_Capabilities::add_caps() doesn't modify. If you have a custom role with the ability to edit any Gravity Forms entries (gravityforms_edit_entries
), you would expect GravityView to match that capability, until the role has been updated with GravityView caps.
array | $usercaps | User's allcaps array |
Definition at line 117 of file class-gravityview-roles-capabilities.php.
Referenced by filter_user_has_cap().
|
private |
Definition at line 55 of file class-gravityview-roles-capabilities.php.
Referenced by __construct().
|
static |
Get an array of GravityView capabilities.
string | $single_role | If set, get the caps_to_check for a specific role. Pass 'all' to get all caps_to_check in a flat array. Default: all |
boolean | $flat_array | True: return all caps in a one-dimensional array. False: a multi-dimensional array with $single_role as keys and the caps as the values |
Definition at line 244 of file class-gravityview-roles-capabilities.php.
filter_user_has_cap | ( | $usercaps = array() , |
|
$caps = array() , |
|||
$args = array() , |
|||
$user = NULL |
|||
) |
Add support for gravityview_full_access
capability, and.
array | $allcaps | An array of all the user's capabilities. |
array | $caps | Actual capabilities for meta capability. |
array | $args | Optional parameters passed to has_cap(), typically object ID. |
WP_User | null | $user | The user object, in WordPress 3.7.0 or higher |
Enable all GravityView caps_to_check if gravityview_full_access
is enabled
Definition at line 77 of file class-gravityview-roles-capabilities.php.
References add_gravity_forms_usercaps_to_gravityview_caps().
|
static |
Definition at line 34 of file class-gravityview-roles-capabilities.php.
Referenced by Plugin\activate(), and Plugin\uninstall().
|
static |
Check whether the current user has a capability.
user_has_cap
filterstring | array | $caps_to_check | Single capability or array of capabilities |
int | null | $object_id | (optional) Parameter can be used to check for capabilities against a specific object, such as a post or us |
int | null | $user_id | (optional) Check the capabilities for a user who is not necessarily the currently logged-in user |
gravityview/capabilities/allow_logged_out
Shall we allow a cap check for non-logged in users? USE WITH CAUTION!WARNING: This allows anyone to edit and delete entries, add notes, delete notes, etc!
If you use this filter, at least check against certain capabilities and $object_ids.
There are use-cases, albeit strange ones, where we'd like to check and override capabilities for for a non-logged in user.
Examples, you ask? https://github.com/gravityview/GravityView/issues/826
boolean | $allow_logged_out | Allow the capability check or bail without even checking. Default: false. Do not allow. Do not pass Go. Do not collect $200. |
string | array | $caps_to_check | Single capability or array of capabilities to check against |
int | null | $object_id | (optional) Parameter can be used to check for capabilities against a specific object, such as a post or us. |
int | null | $user_id | (optional) Check the capabilities for a user who is not necessarily the currently logged-in user. |
We bail with a negative response without even checking if:
gravityview/capabilities/allow_logged_out
filter).Definition at line 336 of file class-gravityview-roles-capabilities.php.
Referenced by GravityView_Field_Is_Starred\get_content(), GVCommon\has_cap(), and GravityView_Field_Is_Starred\print_script().
|
static |
Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against.
array | $caps_to_check |
Definition at line 405 of file class-gravityview-roles-capabilities.php.
members_register_cap_group | ( | ) |
Add GravityView group to Members 1.x plugin management screen.
Definition at line 141 of file class-gravityview-roles-capabilities.php.
References $args.
|
static |
Merge capabilities array with GravityView capabilities.
array | $caps | Existing capabilities |
Definition at line 163 of file class-gravityview-roles-capabilities.php.
remove_caps | ( | ) |
Remove all GravityView caps_to_check from all roles.
Remove all GravityView caps_to_check from all roles
Definition at line 432 of file class-gravityview-roles-capabilities.php.
References wp_roles().
|
private |
Retrieves the global WP_Roles instance and instantiates it if necessary.
WP_Roles $wp_roles WP_Roles global instance.
Definition at line 179 of file class-gravityview-roles-capabilities.php.
Referenced by add_caps(), and remove_caps().
|
static |
Definition at line 28 of file class-gravityview-roles-capabilities.php.