| @@ -197,8 +197,11 @@ | ||
| 197 | 197 | if ( ! function_exists( 'get_editable_roles' ) ) { |
| 198 | 198 | require_once ABSPATH . '/wp-admin/includes/user.php'; |
| 199 | 199 | } |
| 200 | 200 | $this->user_roles = array_keys( get_editable_roles() ); |
| 201 | + if ( is_multisite() ) { | |
| 202 | + $this->user_roles[] = 'super_admin'; | |
| 203 | + } | |
| 201 | 204 | // Define some other defaults. |
| 202 | 205 | $this->custom_graphic_type = $default_values['custom_graphic_type']; |
| 203 | 206 | $this->custom_graphic_url = $default_values['custom_graphic_url']; |
| 204 | 207 | $this->custom_graphic_link = $default_values['custom_graphic_link']; |
| @@ -220,9 +223,11 @@ | ||
| 220 | 223 | * |
| 221 | 224 | * @return void |
| 222 | 225 | */ |
| 223 | 226 | protected function after_load(): void { |
| 224 | - $this->user_roles = array_values( $this->user_roles ); | |
| 227 | + $this->user_roles = array_values( $this->user_roles ); | |
| 228 | + $this->force_auth_roles = array_values( array_intersect( $this->force_auth_roles, $this->user_roles ) ); | |
| 229 | + $this->force_auth = array() !== $this->force_auth_roles; | |
| 225 | 230 | } |
| 226 | 231 | |
| 227 | 232 | /** |
| 228 | 233 | * Check if a plugin is in conflict with the current instance. |
| @@ -228,9 +233,9 @@ | ||
| 228 | 233 | * Check if a plugin is in conflict with the current instance. |
| 229 | 234 | * |
| 230 | 235 | * @param string $plugin The plugin to check for conflict. |
| 231 | 236 | * |
| 232 | - * @return int Returns 0 if the plugin is not in conflict, 1 if it is in conflict, and 0 if it is not in conflict | |
| 237 | + * @return int|bool Returns 0 if the plugin is not in conflict, true if it is in conflict, and false if it is not in conflict | |
| 233 | 238 | * but has been marked as not conflicting. |
| 234 | 239 | */ |
| 235 | 240 | public function is_conflict( $plugin ) { |
| 236 | 241 | if ( in_array( $plugin, $this->is_conflict, true ) ) { |
| @@ -306,9 +311,11 @@ | ||
| 306 | 311 | * @return bool Returns true if the 2FA feature is active, false otherwise. |
| 307 | 312 | * @since 3.12.0 |
| 308 | 313 | */ |
| 309 | 314 | public function is_active(): bool { |
| 310 | - return (bool) apply_filters( 'wd_2fa_enable', $this->enabled ); | |
| 315 | + $enable = apply_filters( 'wd_2fa_enable', $this->enabled ); | |
| 316 | + | |
| 317 | + return is_bool( $enable ) ? $enable : (bool) $enable; | |
| 311 | 318 | } |
| 312 | 319 | |
| 313 | 320 | /** |
| 314 | 321 | * Retrieves the module name for Two-Factor Authentication. |