Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 241
Coder
Coder
Offline
Joined: May 1999
Posts: 241
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!


--------------------
Matt Reinfeldt
http://www.mattreinfeldt.com/
Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)