mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 14:43:49 +09:00
Merge pull request #1672 from ultimatemember/feature/user_auto_approve
User auto approve
This commit is contained in:
@@ -113,6 +113,11 @@ add_action( 'um_user_register', 'um_after_insert_user', 1, 3 );
|
||||
* @param $user_id
|
||||
*/
|
||||
function um_send_registration_notification( $user_id ) {
|
||||
if ( is_admin() ) {
|
||||
// Don't send email notifications to administrators about new user registration, because the user was created from wp-admin.
|
||||
return;
|
||||
}
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
$registration_status = um_user( 'status' );
|
||||
|
||||
@@ -137,7 +142,12 @@ add_action( 'um_registration_complete', 'um_send_registration_notification' );
|
||||
* @param null|array $form_data
|
||||
*/
|
||||
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( 'admin_ignore_user_status' ) ) {
|
||||
$registration_status = 'approved';
|
||||
} else {
|
||||
$registration_status = um_user( 'status' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after complete UM user registration.
|
||||
* Where $status can be equal to 'approved', 'checkmail' or 'pending'.
|
||||
@@ -172,6 +182,7 @@ function um_check_user_status( $user_id, $args, $form_data = null ) {
|
||||
if ( is_null( $form_data ) || is_admin() ) {
|
||||
return;
|
||||
}
|
||||
// Code below is running only for registration from the frontend forms.
|
||||
|
||||
/**
|
||||
* Fires after complete UM user registration. Only for the frontend action which is run before autologin and redirects.
|
||||
|
||||
Reference in New Issue
Block a user