@@ 151-168 (lines=18) @@ | ||
148 | * It also allows other plugins to add the capability to other roles |
|
149 | * |
|
150 | */ |
|
151 | public function add_roles_capabilities() { |
|
152 | ||
153 | // by default, only administrators can configure the plugin |
|
154 | $role = get_role( 'administrator' ); |
|
155 | $role->add_cap( 'configure_salesforce' ); |
|
156 | ||
157 | // hook that allows other roles to configure the plugin as well |
|
158 | $roles = apply_filters( $this->option_prefix . 'roles_configure_salesforce', null ); |
|
159 | ||
160 | // for each role that we have, give it the configure salesforce capability |
|
161 | if ( null !== $roles ) { |
|
162 | foreach ( $roles as $role ) { |
|
163 | $role = get_role( $role ); |
|
164 | $role->add_cap( 'configure_salesforce' ); |
|
165 | } |
|
166 | } |
|
167 | ||
168 | } |
|
169 | ||
170 | /** |
|
171 | * Set the installed version |
@@ 100-116 (lines=17) @@ | ||
97 | * It also allows other plugins to remove the capability from other roles |
|
98 | * |
|
99 | */ |
|
100 | public function remove_roles_capabilities() { |
|
101 | ||
102 | // by default, only administrators can configure the plugin |
|
103 | $role = get_role( 'administrator' ); |
|
104 | $role->remove_cap( 'configure_salesforce' ); |
|
105 | ||
106 | // hook that allows other roles to configure the plugin as well |
|
107 | $roles = apply_filters( $this->option_prefix . 'roles_configure_salesforce', null ); |
|
108 | ||
109 | // for each role that we have, remove the configure salesforce capability |
|
110 | if ( null !== $roles ) { |
|
111 | foreach ( $roles as $role ) { |
|
112 | $role->remove_cap( 'configure_salesforce' ); |
|
113 | } |
|
114 | } |
|
115 | ||
116 | } |
|
117 | ||
118 | /** |
|
119 | * Flush the plugin cache |