mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- add auto approval after the wp-admin registration
This commit is contained in:
@@ -753,6 +753,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'use_um_gravatar_default_image' => array(
|
||||
'sanitize' => 'bool',
|
||||
),
|
||||
'auto_user_approve' => array(
|
||||
'sanitize' => 'bool',
|
||||
),
|
||||
'delete_comments' => array(
|
||||
'sanitize' => 'bool',
|
||||
),
|
||||
@@ -1182,6 +1185,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'description' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo/avatar).', 'ultimate-member' ),
|
||||
'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'auto_user_approve',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Ignore the "User Role > Registration Options"', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Automatically approve users from the wp-admin dashboard', 'ultimate-member' ),
|
||||
'description' => __( 'Ignore registration settings and automatically approve the user if this user is added from the wp-admin dashboard.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'delete_comments',
|
||||
'type' => 'checkbox',
|
||||
|
||||
@@ -658,6 +658,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'use_gravatars' => false,
|
||||
'use_um_gravatar_default_builtin_image' => 'default',
|
||||
'use_um_gravatar_default_image' => false,
|
||||
'auto_user_approve' => false,
|
||||
'toggle_password' => false,
|
||||
'require_strongpass' => false,
|
||||
'password_min_chars' => 8,
|
||||
|
||||
@@ -113,6 +113,10 @@ add_action( 'um_user_register', 'um_after_insert_user', 1, 3 );
|
||||
* @param $user_id
|
||||
*/
|
||||
function um_send_registration_notification( $user_id ) {
|
||||
if ( is_admin() && UM()->options()->get( 'auto_user_approve' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
$registration_status = um_user( 'status' );
|
||||
|
||||
@@ -138,6 +142,12 @@ add_action( 'um_registration_complete', 'um_send_registration_notification' );
|
||||
*/
|
||||
function um_check_user_status( $user_id, $args, $form_data = null ) {
|
||||
$registration_status = um_user( 'status' );
|
||||
|
||||
if ( ( is_null( $form_data ) || is_admin() ) && UM()->options()->get( 'auto_user_approve' ) ) {
|
||||
UM()->common()->users()->set_status( $user_id, 'approved' );
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after complete UM user registration.
|
||||
* Where $status can be equal to 'approved', 'checkmail' or 'pending'.
|
||||
|
||||
Reference in New Issue
Block a user