Add scheduled user account status check and improve approval

Introduce a new `Users` class to handle scheduled tasks for user status checks and batch processing. Refactor user approval functionality to allow silent operations and avoid sending notifications where unnecessary. Enhance user registration to prevent unfinished registrations from being processed in scheduled checks.
This commit is contained in:
Mykyta Synelnikov
2025-04-14 23:12:29 +03:00
parent 08a7b48d53
commit c8bd79fceb
4 changed files with 144 additions and 79 deletions
+7
View File
@@ -169,6 +169,8 @@ function um_check_user_status( $user_id, $args, $form_data = null ) {
*/
do_action( "um_post_registration_{$registration_status}_hook", $user_id, $args, $form_data );
delete_user_meta( $user_id, 'um_registration_in_progress' ); // Status is set. We can delete this marker.
if ( is_null( $form_data ) || is_admin() ) {
return;
}
@@ -502,6 +504,11 @@ function um_submit_form_register( $args, $form_data ) {
'user_pass' => $user_password,
'user_email' => $user_email,
'role' => $user_role,
'meta_input' => array(
// It's used to ignore users who cannot finish the registration process in the scheduled tasks
// to set 'approved' status to the users without `account_status` meta.
'um_registration_in_progress' => true,
),
);
$user_id = wp_insert_user( $userdata );