Tests if registration is open to everyone and the default role is privileged.
Source
public function get_test_insecure_registration() {
$users_can_register = get_option( 'users_can_register' );
$default_role = get_option( 'default_role' );
$result = array(
'label' => __( 'Open Registration with privileged default role' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Security' ),
'color' => 'blue',
),
'description' => '<p>' . __( 'The combination of open registration setting and the default user role may lead to security issues.' ) . '</p>',
'actions' => '',
'test' => 'insecure_registration',
);
if ( $users_can_register && in_array( $default_role, array( 'editor', 'administrator' ), true ) ) {
$result['description'] = __( 'Registration is open to anyone, and the default role is set to a privileged role.' );
$result['status'] = 'critical';
$result['actions'] = sprintf(
'<p><a href="%s">%s</a></p>',
esc_url( admin_url( 'options-general.php' ) ),
__( 'Change these settings' )
);
}
return $result;
}
Changelog
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.