Does that then send an email to all of them?you should be able to do it using batch update users manually. above addon is pretty useful to automate the process to do it regularly.
basically search for users who haven't logged on till x number of days. and then mark those accounts for reset password.
1) Run the batch as stated but add to a user group and set password reset.Does that then send an email to all of them?
User must change password will force the user to enter their existing password and create a new, different password when they next log in to their account.
User must reset password forces the user to reset their password by responding to a message sent to their registered email address.
Exactly, but no email is sent. To do so add them to a group then send the group an email.it is a bit confusing for me as well. i believe reset password would require user to have access to connected email account so this is better.
second option is more of a precautionary change like you just prefer if they would change their password. this would be kind of useless in case of hacked accounts.
Maybe by SQL query but not XF.Thanks for all the help.
I don't suppose there's a way to batch update based on when the password was last updated.
I'm not sure XF writes a tomestamp to the DB when a password is reset. You would need to look @ the xf_user table to see if it is tracked. I'm pretty sure it is not.Anybody know how to compose that query?
In my case, thousands of users had old/bounced emails. Mass emailing might be a bigger headache than it's worth.So it doesn't automatically send out an email?
That would be my preference.
What's the difference between "User must reset password" versus "User must change password"?
That's exactly what happens, a password reset is automatically sent to their inbox WHEN they visit the site.Yeah, I specifically didn't want to send out a mass email. Just have an email triggered when/if they try to log in.
Hmm... so how do you do that? I do notice the Contact Us link doesn't work for accounts that got the reset. Also how do I show a notice to just locked accounts.DO be sure that ALL accounts can use the "contact us"....XF fails at permissions when it comes to users that fall within the "security lock" parameters. I ended up with a dismissable notice with WHY their password no longer worked, and contact info should their email be no longer accessible.
<?php
if (PHP_SAPI != 'cli')
{
exit();
}
ignore_user_abort(true);
$dir = __DIR__;
require($dir . '/src/XF.php');
XF::start($dir);
$app = XF::setupApp('XF\Pub\App');
// Array of user IDs to update
$user_ids = [
1, 2, ,3 ,4
];
// Password to set for all users
$newPassword = 'NEWPASS';
// Create log file
$logFile = __DIR__ . '/password_update_log_' . date('Y-m-d_H-i-s') . '.txt';
$log = fopen($logFile, 'w');
// Initialize counters
$successCount = 0;
$failCount = 0;
$notFoundCount = 0;
// Get users
$users = \XF::finder('XF:User')->whereIds($user_ids)->fetch();
foreach($users as $user)
{
try {
$auth = $user->getRelationOrDefault('Auth');
$auth->setPassword($newPassword);
$auth->save();
$message = "SUCCESS: Password updated for user ID {$user->user_id} (Username: {$user->username})";
echo $message . "\n";
fwrite($log, $message . "\n");
$successCount++;
} catch (\Exception $e) {
$message = "ERROR: Failed to update password for user ID {$user->user_id}: " . $e->getMessage();
echo $message . "\n";
fwrite($log, $message . "\n");
$failCount++;
}
}
// Write summary to log
$summary = "\nOperation Summary:\n";
$summary .= "Total users processed: " . count($user_ids) . "\n";
$summary .= "Successful updates: " . $successCount . "\n";
$summary .= "Failed updates: " . $failCount . "\n";
$summary .= "Operation Completed: " . date('Y-m-d H:i:s');
echo $summary;
fwrite($log, $summary);
// Close log file
fclose($log);
We use essential cookies to make this site work, and optional cookies to enhance your experience.