This repository has been archived by the owner on Jan 9, 2020. It is now read-only.
/
users.php
57 lines (51 loc) · 1.87 KB
/
users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
* Custom Role for Client User
* The role has all of the capabilities of an editor, plus the ability to manage theme options.
* Theme options inculde widgets, menus, theme options (if theme supports), custom backbground (if theme supports), custom header (if theme supports).
* Optionally, the role can have the capability of creating new users by uncommenting create_users and list_users
*
* For more capability options, see http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table
*
*/
add_action('admin_init', 'silencio_custom_role');
function silencio_custom_role() {
if (!get_role('client_user')) {
// let's use the editor as the base capabilities
$caps = get_role('editor')->capabilities;
// add our new capabilities
$caps = array_merge(
$caps,
array(
'edit_theme_options' => true,
'create_users' => true,
'edit_users' => true,
'delete_users' => true,
'list_users' => true,
'remove_users' => true,
'promote_users' => true
)
);
add_role('client_user', 'Client User', $caps);
}
// Gravity Forms Permissions
if (!get_role('forms_user')) {
// let's use the subscriber as the base capabilities
$caps = get_role('subscriber')->capabilities;
// add our new capabilities
$caps = array_merge(
$caps,
array(
'gravityforms_view_entries' => true,
'gravityforms_export_entries' => true,
'gravityforms_delete_entries' => true
)
);
add_role('forms_user', 'Forms User', $caps);
}
}
function add_grav_forms() {
$role = get_role('client_user');
$role->add_cap('gform_full_access');
}
add_action('admin_init', 'add_grav_forms');