mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Update to version 2.10.4 with bug fixes and improved user handling
This update fixes issues related to handling empty user statuses, ensuring proper account status checks and admin notice resets. It also updates plugin assets, documentation, and test scripts to reflect the new version (2.10.4). Additional improvements include enhanced error logging for more reliable diagnostics.
This commit is contained in:
@@ -45,6 +45,8 @@ if ( ! class_exists( 'um\common\actions\Users' ) ) {
|
||||
}
|
||||
|
||||
public function status_check() {
|
||||
// Make the control checking of the empty user statuses inside the function `get_empty_status_users`.
|
||||
// Maybe some users were approved manually or deleted and we need to reset the admin notice.
|
||||
$total_users = UM()->common()->users()::get_empty_status_users();
|
||||
if ( empty( $total_users ) ) {
|
||||
return;
|
||||
@@ -114,8 +116,11 @@ if ( ! class_exists( 'um\common\actions\Users' ) ) {
|
||||
|
||||
foreach ( $results as $user_id ) {
|
||||
$res = UM()->common()->users()->approve( $user_id, true, true );
|
||||
if ( $res ) {
|
||||
if ( $res || UM()->common()->users()->has_status( $user_id, 'approved' ) ) {
|
||||
++$um_empty_status_users[0];
|
||||
} else {
|
||||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
||||
error_log( 'Cannot set `approved` status for the user with ID:' . $user_id );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +140,19 @@ if ( ! class_exists( 'um\common\actions\Users' ) ) {
|
||||
'pages' => $pages,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Make the control checking of the empty user statuses.
|
||||
// Maybe some users were approved manually or deleted and we need to reset the admin notice.
|
||||
$total_users = UM()->common()->users()::get_empty_status_users();
|
||||
if ( empty( $total_users ) ) {
|
||||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
||||
error_log( 'There aren\'t users with empty `account_status`. Maybe some users were approved manually or deleted.' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
||||
error_log( 'There aren\'t users with empty `account_status`. Maybe some users were approved manually or deleted.' );
|
||||
delete_option( '_um_log_empty_status_users' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,18 +840,23 @@ class Users {
|
||||
global $wpdb;
|
||||
|
||||
$total_users = $wpdb->get_var(
|
||||
"SELECT COUNT(u.ID)
|
||||
"SELECT COUNT(DISTINCT u.ID)
|
||||
FROM {$wpdb->users} u
|
||||
LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id AND um.meta_key = 'account_status'
|
||||
LEFT JOIN {$wpdb->usermeta} um2 ON u.ID = um2.user_id AND um2.meta_key = '_um_registration_in_progress'
|
||||
WHERE ( um.meta_value IS NULL OR um.meta_value = '' ) AND
|
||||
um2.meta_value IS NULL OR um2.meta_value != '1'"
|
||||
( um2.meta_value IS NULL OR um2.meta_value != '1' )"
|
||||
);
|
||||
|
||||
$total_users = absint( $total_users );
|
||||
// In WordPress, an underscore prefix before the option name (e.g., _my_option_name) is commonly used to indicate that the option is private.
|
||||
// This option has a format: {updated_users}/{total_users_for_update}.
|
||||
update_option( '_um_log_empty_status_users', array( 0, $total_users ) );
|
||||
if ( $total_users > 0 ) {
|
||||
// In WordPress, an underscore prefix before the option name (e.g., _my_option_name) is commonly used to indicate that the option is private.
|
||||
// This option has a format: {updated_users}/{total_users_for_update}.
|
||||
update_option( '_um_log_empty_status_users', array( 0, $total_users ) );
|
||||
} else {
|
||||
// Delete option for the cases when there aren't empty `account_status` users. But admin notice is still displayed.
|
||||
delete_option( '_um_log_empty_status_users' );
|
||||
}
|
||||
|
||||
return $total_users;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user