Welcome to Geeklog, Anonymous Saturday, November 23 2024 @ 10:52 am EST
Geeklog Forums
hmmmmm???
Page navigation
FreakWorld
Anonymous
Is there a way to make a user account email more thin 1 email?
The reason I am asking, is I have 5 Admin on my site.
So when someone has a problem. I want it to email all the admins so the first 1 on line can get to it.
The reason I am asking, is I have 5 Admin on my site.
So when someone has a problem. I want it to email all the admins so the first 1 on line can get to it.
28
26
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
untested
if you have your admins all in the 'root' group then do this:
first, find this code in the function contactemail() in profiles.php (line 99ish of 1.3.11):
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
second, replace it with this:
if($uid != 2){
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
} elseif ($uid == 2){//if mail is being sent to admin/root
$to = '';
//get user ids of group 'root'
$result = DB_query("SELECT ug_uid FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id='1'");
if(DB_numRows($result) >= 1){
//for each of your admins add their email addy to $to
//i think mail.php can take an array or list of comma separated recipients...
while($A = DB_fetchArray($result)){
$Bresult = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = {$A['ug_uid']}");
$B = DB_fetchArray($Bresult);
if (!empty ($B['fullname'])) {
$to .= ',' . COM_formatEmailAddress ($B['fullname'], $B['email']);
} else {
$to .= ',' . COM_formatEmailAddress ($B['username'], $B['email']);
}
}
}
}
that sends mail to all members of 'root' group whenever the site admin is being mailed. ...i think
Like i said, it is untested.
if you have your admins all in the 'root' group then do this:
first, find this code in the function contactemail() in profiles.php (line 99ish of 1.3.11):
Text Formatted Code
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
second, replace it with this:
Text Formatted Code
if($uid != 2){
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
} elseif ($uid == 2){//if mail is being sent to admin/root
$to = '';
//get user ids of group 'root'
$result = DB_query("SELECT ug_uid FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id='1'");
if(DB_numRows($result) >= 1){
//for each of your admins add their email addy to $to
//i think mail.php can take an array or list of comma separated recipients...
while($A = DB_fetchArray($result)){
$Bresult = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = {$A['ug_uid']}");
$B = DB_fetchArray($Bresult);
if (!empty ($B['fullname'])) {
$to .= ',' . COM_formatEmailAddress ($B['fullname'], $B['email']);
} else {
$to .= ',' . COM_formatEmailAddress ($B['username'], $B['email']);
}
}
}
}
that sends mail to all members of 'root' group whenever the site admin is being mailed. ...i think
Like i said, it is untested.
35
22
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
btw, this neglects to check the user's personal prefs, e.g., perhaps one of your admins doesn't want to get mail--this will not check his preference.
30
29
Quote
FreakWorld
Anonymous
cool thanks.
If they don't want to talk to members. Thin they need to stop being an admin. LOL
If they don't want to talk to members. Thin they need to stop being an admin. LOL
25
24
Quote
FreakWorld
Anonymous
it works kinda.
1 problem.
It's sending 2 emails to everyone.
any ideas why?
1 problem.
It's sending 2 emails to everyone.
any ideas why?
27
26
Quote
FreakWorld
Anonymous
after more test it's sending a number of emails to admins.
Say there is 3 admins.
Thin EACH admin well get 3 emails from 1 email.
Or say there is 2 admin.
Thin we well get 2 emails from 1.
Say there is 3 admins.
Thin EACH admin well get 3 emails from 1 email.
Or say there is 2 admin.
Thin we well get 2 emails from 1.
39
27
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by FreakWorld:
any ideas why?
any ideas why?
yes... but i'm just out the door so i'll catch you later tonight
24
27
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
find this line,
in function COM_formatEmailAddress() in lib-common.php and add a semicolon just after the address like this:
dunno if that will solve the problem but its a place to start.
hope that helps
Text Formatted Code
return $formatted_name . ' <' . $address . '>';Text Formatted Code
return $formatted_name . ' <' . $address . '>;';dunno if that will solve the problem but its a place to start.
hope that helps
33
26
Quote
FreakWorld
Anonymous
man I hate to tell you, but it stopped the email all together.
26
21
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
lol...
k, try this: edit your while condition to this:
now it should not go over each admin twice--i'm assuming that it was adding an address for the index and then again for the assoc.
how can you tell i'm not testing any of this?
k, try this: edit your while condition to this:
Text Formatted Code
while($A = DB_fetchArray($result,false)){how can you tell i'm not testing any of this?
28
24
Quote
FreakWorld
Anonymous
Want to check with you first.
1st code change keep?
2nd code change keep?
And all the while conditions in the lib-common.php?
There is a few.......
1st code change keep?
2nd code change keep?
And all the while conditions in the lib-common.php?
There is a few.......
18
31
Quote
FreakWorld
Anonymous
what I did try is, changing "while" in the first code you gave me.
with the ; in the lib-common.php it did not email anything.
with out it, it emails me mutable times like the first test.
lol if you don't mind working on this.
I don't mind testing your ideas.
with the ; in the lib-common.php it did not email anything.
with out it, it emails me mutable times like the first test.
lol if you don't mind working on this.
I don't mind testing your ideas.
25
23
Quote
FreakWorld
Anonymous
so did you give up on me?
30
30
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
try this slightly modified version of the above code...
if($uid != 2){
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
} elseif ($uid == 2){//if mail is being sent to admin/root
$to = array();
//get user ids of group 'root'
$resultA = DB_query("SELECT ug_uid FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id='1'");
if(DB_numRows($resultA) >= 1){
//for each of your admins add their email addy to $to
//i think mail.php can take an array or list of comma separated recipients...
while($A = DB_fetchArray($resultA)){
$resultB = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = {$A['ug_uid']}");
$B = DB_fetchArray($resultB);
if (!empty ($B['fullname'])) {
$to[] = COM_formatEmailAddress ($B['fullname'], $B['email']);
} else {
$to[] = COM_formatEmailAddress ($B['username'], $B['email']);
}
}
}
}
Text Formatted Code
if($uid != 2){
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
} elseif ($uid == 2){//if mail is being sent to admin/root
$to = array();
//get user ids of group 'root'
$resultA = DB_query("SELECT ug_uid FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id='1'");
if(DB_numRows($resultA) >= 1){
//for each of your admins add their email addy to $to
//i think mail.php can take an array or list of comma separated recipients...
while($A = DB_fetchArray($resultA)){
$resultB = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = {$A['ug_uid']}");
$B = DB_fetchArray($resultB);
if (!empty ($B['fullname'])) {
$to[] = COM_formatEmailAddress ($B['fullname'], $B['email']);
} else {
$to[] = COM_formatEmailAddress ($B['username'], $B['email']);
}
}
}
}
23
27
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
any word on success or not?
29
26
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
yes, this will do the same for moderator(s). You just need the user id of the moderator(s) or the moderator's group id; and decide what uid triggers this mail (for example, the above code is triggered when someone sends mail to the site admin at uid #2).
. ...and be careful not to disable regular mail to all other members.
. ...and be careful not to disable regular mail to all other members.
24
29
Quote
Page navigation
All times are EST. The time is now 10:52 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content