-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
50 lines (37 loc) · 1.24 KB
/
install.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
<?php
defined( 'WPINC' ) && new Installer;
class Installer {
public function __construct() {
add_option( 'kntnt-cta', [] );
$this->add_capabilities( [
// Roles that get all capabilities by default.
'administrator',
'editor',
], [
// Capabilities for managing CTAs (custom post type)
'kntnt_edit_ctas',
'kntnt_edit_others_ctas',
'kntnt_edit_private_ctas',
'kntnt_edit_published_ctas',
'kntnt_publish_ctas',
'kntnt_read_private_ctas',
'kntnt_delete_ctas',
'kntnt_delete_others_ctas',
'kntnt_delete_private_ctas',
'kntnt_delete_published_ctas',
// Capabilities for managing CTA Groups (custom taxonomy)
'kntnt_manage_cta_groups',
'kntnt_edit_cta_groups',
'kntnt_delete_cta_groups',
'kntnt_assign_cta_groups',
] );
}
private function add_capabilities( $roles, $capabilities ) {
foreach ( $roles as $role ) {
$role = get_role( $role );
foreach ( $capabilities as $capability ) {
$role->add_cap( $capability );
}
}
}
}