Used to end all user sessions except the current session when a password reset is initiated.
Location
users/helpers/us_helpers.php
Parameters
#
Parameter
Data Type
Required
Description
1
$uid = null
string
No
the user ID for which the sessions need to be killed. If null, the function will kill all sessions except the current one.
Returns
Data Type
Description of Returned Data
int
If successful, the function will return the number of sessions killed.
If an error occurs, the function will return the error message.
Further Documentation:
Example usage:
// Kill all sessions for the current user except the current session $password_reset_success = passwordResetKillSessions();
if ($password_reset_success > 0) {
echo "Password reset successful. All other sessions have been terminated.";
} else {
echo "Password reset failed. Unable to kill sessions.";
}
// Kill all sessions for a specific user $password_reset_success = passwordResetKillSessions(123);
if ($password_reset_success > 0) {
echo "Password reset successful. All sessions for user ID 123 have been terminated.";
} else {
echo "Password reset failed. Unable to kill sessions for user ID 123.";
}