class-wpml-upgrade-fix-non-admin-cap.php
717 Bytes
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
<?php
class WPML_Upgrade_Fix_Non_Admin_With_Admin_Cap implements IWPML_Upgrade_Command {
private $results = array();
/**
* @return bool|void
*/
public function run_admin() {
$user = new WP_User( 'admin' );
if ( $user->exists() && ! is_super_admin( $user->get( 'ID' ) ) ) {
$wpml_capabilities = array_keys( wpml_get_capabilities() );
foreach ( $wpml_capabilities as $capability ) {
$user->remove_cap( $capability );
}
}
return true;
}
/**
* @return bool
*/
public function run_ajax() {
return false;
}
/**
* @return bool
*/
public function run_frontend() {
return false;
}
/**
* @return null
*/
public function get_results() {
return $this->results;
}
}