Merge pull request #1672 from ultimatemember/feature/user_auto_approve

User auto approve
This commit is contained in:
Mykyta Synelnikov
2025-04-14 16:05:20 +03:00
committed by GitHub
3 changed files with 23 additions and 1 deletions
+12 -1
View File
@@ -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.