mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
Allow age of user to be chosen before sending emails to unactivated users.
This commit is contained in:
@@ -300,7 +300,8 @@ class users_admin_ui extends e_admin_ui
|
|||||||
if(!empty($_POST['resendToAll']))
|
if(!empty($_POST['resendToAll']))
|
||||||
{
|
{
|
||||||
$resetPasswords = !empty($_POST['resetPasswords']);
|
$resetPasswords = !empty($_POST['resetPasswords']);
|
||||||
$this->resend_to_all($resetPasswords);
|
$age = vartrue($_POST['resendAge'], 24);
|
||||||
|
$this->resend_to_all($resetPasswords, $age);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1832,10 +1833,12 @@ class users_admin_ui extends e_admin_ui
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$age = strtotime('24 hours ago');
|
$age = array(
|
||||||
|
3=>'3 hours', 6=> "6 hours", 24 => "24 hours", 48 => '48 hours', 72 => '3 days'
|
||||||
|
);
|
||||||
|
|
||||||
$count = $sql->count('user','(*)',"user_ban = 2 AND user_join < ".$age);
|
$count = $sql->count('user','(*)',"user_ban = 2 ");
|
||||||
$caption = $tp->lanVars('Resend account activation email to [x] users who are older than 24 hours.',$count);
|
$caption = $tp->lanVars('Resend account activation email to unactivated users.',$count);
|
||||||
|
|
||||||
$text = $frm->open('userMaintenance','post');
|
$text = $frm->open('userMaintenance','post');
|
||||||
|
|
||||||
@@ -1847,7 +1850,11 @@ class users_admin_ui extends e_admin_ui
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<tr><td>".$caption."<td>
|
<tr><td>".$caption."<td>
|
||||||
<td>
|
<td>
|
||||||
<div class='form-inline'>".$frm->button('resendToAll', 1, 'warning', LAN_GO). $frm->checkbox('resetPasswords',1,false,'Reset all passwords')."
|
<div>Older than ".$frm->select('resendAge', $age, 24).$frm->checkbox('resetPasswords',1,false,'Reset all passwords').
|
||||||
|
|
||||||
|
$frm->button('resendToAll', 1, 'warning', LAN_GO)."
|
||||||
|
|
||||||
|
|
||||||
</div></td></tr>
|
</div></td></tr>
|
||||||
</table>";
|
</table>";
|
||||||
|
|
||||||
@@ -1861,18 +1868,12 @@ class users_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an activation email to all unactivated users older than so many hours.
|
||||||
|
* @param bool $resetPasswords
|
||||||
|
* @param int $age in hours. ie. older than 24 hours will be sent an email.
|
||||||
|
*/
|
||||||
|
function resend_to_all($resetPasswords=false, $age=24)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// It might be used in the future - batch options
|
|
||||||
function resend_to_all($resetPasswords=false)
|
|
||||||
{
|
{
|
||||||
global $sql,$pref;
|
global $sql,$pref;
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@@ -1883,7 +1884,8 @@ class users_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
e107::lan('core','signup');
|
e107::lan('core','signup');
|
||||||
|
|
||||||
$age = strtotime('24 hours ago');
|
$ageOpt = intval($age)." hours ago";
|
||||||
|
$age = strtotime($ageOpt);
|
||||||
|
|
||||||
$query = "SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 AND u.user_join < ".$age." ORDER BY u.user_id DESC";
|
$query = "SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 AND u.user_join < ".$age." ORDER BY u.user_id DESC";
|
||||||
|
|
||||||
@@ -1911,7 +1913,7 @@ class users_admin_ui extends e_admin_ui
|
|||||||
{
|
{
|
||||||
echo "error updating user's password";
|
echo "error updating user's password";
|
||||||
print_a($updateQry);
|
print_a($updateQry);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['user_sess'] = $sessKey;
|
$row['user_sess'] = $sessKey;
|
||||||
@@ -1966,8 +1968,12 @@ class users_admin_ui extends e_admin_ui
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if(count($recipients))
|
||||||
|
{
|
||||||
|
$result = $mailer->sendEmails('signup', $mailData, $recipients);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $mailer->sendEmails('signup', $mailData, $recipients);
|
e107::getMessage()->addSuccess("Total emails added to mail queue: ".count($recipients));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user