CyberiaPC.com Community Forums Main Page
RSS Feeds: Late(st) News | Zenith Picture Gallery | Most Recent Community Topics | Tips, Tricks and Other Useful Stuff

Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> Batch emailing users on picture submission
Roberta
post Oct 21 2006, 12:37 PM
Post #1


New Member
*

Group: Members
Posts: 9
Joined: 3-September 06
Member No.: 4,083

Italy




It's possible integrated a information when i put e new image send an info all user are registred.
For example a news letter ?
Go to the top of the page
 
+Quote Post
usr.c
post Oct 25 2006, 04:46 PM
Post #2


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




Sure, look in functions/f_lib.php for (at the very end)

CODE
?>


and above that insert

CODE
//--------------------------------------------
// zenithMailer(), new in v0.9.2 DEV
// Used for batch emailing (uncomment add.php:192 and comment add.php:191 to enable)
// Final version will use something like swift mailer to make the batch sending more efficient
//--------------------------------------------
function zenithMailer($config, $to, $subject, $body, $headers) {
    $recipients = array(); //Container for recipients
    $statement = "SELECT username, email FROM {$config['table_prefix']}users";
    $result = mysql_query($statement);
    while ($row = mysql_fetch_array($result)) $recipients[] = array($row['username'], $row['email']); //get all our emails
    
    foreach($recipients as $value) {
        if(!@mail($value[1], $subject, $body, $headers))   return 0; //if something wrong happened, quit
    }
    
    return 1;
}


In add.php for

CODE
require_once('functions/f_db.php');

and below that insert

CODE
require_once('functions/f_lib.php');

Then look for

CODE
if(!@mail($config['admin_email'],"{$config['title']} New Picture submitted",$body,$headers))

and replace it with

CODE
//if(!@mail($config['admin_email'],"{$config['title']} New Picture submitted",$body,$headers))
if(!zenithMailer($config, $config['admin_email'],"{$config['title']} New Picture submitted",$body,$headers))

Save both files and upload. Can't promise anything efficiency-wise. Let me know if you have any problems.


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
kapangaluis
post Dec 5 2006, 05:40 AM
Post #3


Full Member
Group Icon

Group: +Zenith User
Posts: 92
Joined: 6-February 06
From: Mendoza, Argentina
Member No.: 3,240

Argentina




It is possible that each user selects from his account of user if wishes to receive newsletter and not that arrives at all the registered in the gallery?


Greetings

LUIS
Go to the top of the page
 
+Quote Post
BuCki
post Jan 21 2007, 08:11 AM
Post #4


New Member
*

Group: Members
Posts: 21
Joined: 4-July 06
Member No.: 3,776

United Kingdom




hey Urs.

I did try this one out but did not work!
I got 2 users, I posted some pics with the Admin user and I did NOT
get any notification or email of new posted images in the gallery!

hmmm

whistling.gif
Go to the top of the page
 
+Quote Post
usr.c
post Jan 23 2007, 10:24 PM
Post #5


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




hmm..Not too sure why it wouldn't work if you made the correct modifications. If you want, you can PM me temporary ftp login details and your gallery's URL and I can took a look at it for you original.gif


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st May 2013 - 12:17 AM