Hey Folks!
it was brought up on ubbtdesign.com that not everyone wants to receive the e-mails that the sys admin sends out... currently there is no option for this... so, I went ahead and coded it... []
https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Here are the changes you need to make... (note: I did not use line numbers... you will have to find the surrounding code... sorry, but I don't know what versions everyone is on, and if the line numbers are the same in each version... [:red]code additions/changes are in red)
run this altertable from the Admin -> Database Administration -> SQL Commands
[:red]ALTER TABLE w3t_Users ADD U_AdminEmails CHAR (3) DEFAULT 'On' not null
Then, run this from the same place to set everyone's defaul to 'on'
[:red]update w3t_Users set U_AdminEmails = 'On'
now, we have to edit some files:
editemail.php
change:
// -----------------------------------------
// Get the current profile for this username
$Username_q = addslashes($user['U_Username']);
$query = "
SELECT U_Username,U_EReplies,U_Notify[:red],U_AdminEmails
FROM w3t_Users
WHERE U_Username = '$Username_q'
";
$sth = $dbh -> do_query($query);
add:[:red]
// ------------------------------------------------
// Set the default for receiving Admin E-mails
if ($AdminEmails == "On") {
$doAdminEmail = "checked";
}
else {
$noAdminEmail = "checked";
}
and:
$lang[PROF_NOTIF]<br>
<input type=radio name=Notify value="Off" $nonotify class="formboxes"> $lang[TEXT_NO]
<input type=radio name=Notify value="On" $donotify class="formboxes"> $lang[TEXT_YES]
<p>
$lang[PROF_REPLIES]<br>
<input type=radio name=EReplies value="Off" $noereplies class="formboxes"> $lang[TEXT_NO]
<input type=radio name=EReplies value="On" $ereplies class="formboxes"> $lang[TEXT_YES]
<p>
[:red] $lang[PROF_ADMINEMAILS]<br>
<input type=radio name=AdminEmails value="Off" $noAdminEmail class="formboxes"> $lang[TEXT_NO]
<input type=radio name=AdminEmails value="On" $doAdminEmail class="formboxes"> $lang[TEXT_YES]
";
<p>
changeemail.php
add:
// -----------------------
// Format the query words
$Username_q = addslashes($Username);
$EReplies_q = addslashes($EReplies);
$Notify_q = addslashes($Notify);
[:red] $AdminEmails_q = addslashes($AdminEmails);
// --------------------------
// Update the User's profile
$query = "
UPDATE w3t_Users
SET U_EReplies = '$EReplies_q',
U_Notify = '$Notify_q',
[:red] U_AdminEmails = '$AdminEmails_q'
WHERE U_Username = '$Username_q'
";
$dbh -> do_query($query);
languages\english\editemail.php (need to do this in ALL language folders!)
add:
$lang[PROF_REPLIES] = "Do you want all replies to posts that you make emailed to you?";
[:red]$lang[PROF_ADMINEMAILS] = "Do you want to receive e-mails fomr the Forum Administrator?";
admin/dosendemail.php
add:
// --------------------------------------
// We only send to the groups we selected
$arraysize = sizeof($whatgroups);
for ($i=0; $i<$arraysize; $i++) {
if ($whatgroups[$i] == "sendtoall") {
$groupcheck = "";
break;
}
if (!$i) {
$groupcheck .=" WHERE U_Groups LIKE '%-$whatgroups[$i]-%'";
}
else {
$groupcheck .=" OR U_Groups LIKE '%-$whatgroups[$i]-%'";
}
}
[:red]// add in the check to see if they want admin e-mails
$wantAdminEmails = " AND U_AdminEmails = 'On'";
// -------------------------------
// Grab all of the email addresses
$query = "
SELECT U_Username,U_Email
FROM w3t_Users
$groupcheck
[:red] $wantAdminEmails
";
That's it! If you have any issues/questions let me know!