Plugin could not be activated
-
Hello, I’m trying to activate this plugin but WP (4.0.1) says that plugin could not be activated because it triggered a fatal error:
syntax error, unexpected T_FUNCTION in crosswordsearch.php on line 903
I did check this line and it looks OK but I am not a php-man, sorry.
There is the block of code below and line 903 which cause the error is marked with “line 903” remark. Could you give me any suggestion what to do?
function crw_update_capabilities () {
global $wp_roles;
$error = __(‘Editing rights could not be updated.’, ‘crw-text’);crw_test_permission( ‘cap’, wp_get_current_user() );
$capabilities = json_decode( wp_unslash( $_POST[‘capabilities’] ) );
if ( !is_array($capabilities) ) {
$debug = ‘invalid data: no array’;
crw_send_error($error, $debug);
}$allowed = array(CRW_CAP_CONFIRMED, CRW_CAP_UNCONFIRMED, ”);
$roles_caps = array();
foreach ( $wp_roles->role_objects as $name => $role ) {/**line 903**/ $list = array_filter($capabilities, function ($entry) use ($name) {
return is_object($entry) && $entry->name === $name;
} );
$cap_obj = current( $list );
if ( !$cap_obj ) {
$debug = ‘role missing: ‘ . $name;
crw_send_error($error, $debug);
} elseif ( !in_array( $cap_obj->cap, $allowed, true ) ) {
$debug = ‘corrupt role: ‘ . $name . ‘, ‘ . $cap_obj->cap;
crw_send_error($error, $debug);
}
if (” !== $cap_obj->cap) {
$roles_caps[$name] = $cap_obj->cap;
}
};update_option(CRW_ROLES_OPTION, $roles_caps);
foreach ( $wp_roles->role_objects as $name => $role ) {
$role->remove_cap( CRW_CAP_CONFIRMED );
$role->remove_cap( CRW_CAP_UNCONFIRMED );
if ( array_key_exists($name, $roles_caps) ) {
$role->add_cap( $roles_caps[$name] );
}
}crw_send_capabilities();
}
add_action( ‘wp_ajax_update_crw_capabilities’, ‘crw_update_capabilities’ );
- The topic ‘Plugin could not be activated’ is closed to new replies.