[add-on] Birthday Mailings

3rd party code for phpList

Postby Guest » 5:56pm, Wed 19 Nov, 2008

ajones wrote:Yes, the download link is still 404'd and the author hasn't responded to my PMs. If anyone has the archive could you pass it on to me via PM? I'd be glad to host it.


Hey everyone! This is my first post here, I'm new with PHPList, but I've set it up correctly already. I'm dying to get this birthday plugin to work, manually it's running fine but I need mails to be delivered automatically using CRON.

A simple modification I've made, so as to be able to call the plugin without the need of a form is modify main.php (around line 24):

Code: Select all
else { # do everything else, run the script...
  if (isset($_POST["run"]) || isset($_GET["run"])) {


So I can call the birthday script like this:
http://www.foo.com/lists/admin/?page=ma ... rthday&run

This works fine, but when I call it from a different browser (or using CRON) where I have not logged it from I get:

Code: Select all
This document requires you to log in

login -> Sorry this page was not found in the plugin


Any ideas? Thanks in advance!
Guest
 

Postby Musi » 3:18pm, Tue 16 Dec, 2008

xxx.yourdomain.xxx/lists/admin/?page=main&pi=birthday&runlogin=USERNAME&password=PASSWORD
should work well.
But where can i change the 7 days to 0, so that my CRON just sends out mails to people having birthday right on the same day ?
Is it in a MySQL-Table...

cheers
Musi
phpLister
 
Posts: 6
Joined: 10:25am, Fri 22 Dec, 2006

Postby Kazzie-D » 1:02pm, Wed 25 Mar, 2009

I've applied the Birthday Mod and it works a treat! The only thing I'm struggling with now is the date format, which currently appears as YYYY-MM-DD - does anyone know how to modify it so the date reads DD-MM-YYYY?

Any help on this will be much appreciated! :wink:
Kazzie-D
phpLister
 
Posts: 6
Joined: 12:56pm, Wed 25 Mar, 2009
Location: Cheshire, UK

Postby Hernol » 3:36pm, Thu 26 Mar, 2009

Mmm, you want to change the way the date is displayed, but where?
You will have to change the phplist code for that to work.
Hernol
Admin
 
Posts: 1378
Joined: 6:39pm, Thu 18 May, 2006
Location: Argentina

Postby Kazzie-D » 3:55pm, Thu 26 Mar, 2009

Hi! Thanks for your reply! I have it setup so that when their Birthday comes up, a voucher/html email is sent to them. I have inserted their Name, Address and Birthday fields onto the email, this where the 'Birthday' field is showing up with they year, month and date.

I was just wondering if someone could point me in the right direction as to where I need to look in the code/files to change the way the date is displayed?

Thanks! :)
Kazzie-D
phpLister
 
Posts: 6
Joined: 12:56pm, Wed 25 Mar, 2009
Location: Cheshire, UK

Re: [add-on] Birthday Mailings

Postby brianstorm » 12:25pm, Tue 30 Jun, 2009

Hi,

this is a very useful contribution.... I am wondering how I could duplicate it so that I can send a birthday email 30 days before and on the day... I've tried copying the files and renaming the basic files, and info in the header (eg table names etc) eg. in birthday.php

class birthday_2 extends phplistPlugin {

var $name = "Birthday plugin_2";
var $author = "Hernan Cisneros";
var $coderoot = "plugins/birthday_2/";
#define months' lenght (in days)
var $table = "phplist_user_birthday_2";

Could someone please advise me as to how much code I'd have to change (eg would I need to amend all function names?).... I'm new to phplist and I haven't really got a grip on how its contructed...


Many thanks

Brian
brianstorm
PL Geek
 
Posts: 138
Joined: 9:12am, Fri 26 Jun, 2009

Re: [add-on] Birthday Mailings / Cron

Postby brianstorm » 2:08pm, Thu 02 Jul, 2009

Hi,

has anyone managed to get this plugin to run via Cron?

Am I correct in thinking at I'd need to set a POST variable

submit=Run Birthday Now

on the page

admin/?page=main&pi=birthday

To actually run the plugin?


Or am I barking up the wrong tree?


Advice much apprecciated.....


Thanks


Brian
brianstorm
PL Geek
 
Posts: 138
Joined: 9:12am, Fri 26 Jun, 2009

Re: [add-on] Birthday Mailings

Postby CarBonHck » 12:37pm, Tue 07 Jul, 2009

Hi To All The Members,

I Hope that Someone can describe with some details How To Get This Plugin Running Well.
If it's possible Step By Step.
Thx In Advance Friends.

Good Luck To All.
CarBonHck
phpLister
 
Posts: 12
Joined: 11:11am, Tue 07 Jul, 2009

Re: [add-on] Birthday Mailings

Postby brianstorm » 12:52pm, Tue 07 Jul, 2009

hi,

the plugin works fine, its easy to install... i think it may need rewritten to work from cron, but i'm not sure about that bit yet.... its a great piece of work....

thanks


brian
Replacement Projector Lamps & Accessories in the UK
http://www.london-projectors.co.uk/projector-lamps.php
brianstorm
PL Geek
 
Posts: 138
Joined: 9:12am, Fri 26 Jun, 2009

Re: [add-on] Birthday Mailings

Postby acox » 4:18pm, Tue 25 Aug, 2009

I have installed the plugin - great work - ty.

If i wanted to use it for another annual event (such as car MOT or subscription renewal) i guess one would just copy the plugin and rename it and then point to another date attribute?

Many thanks!
acox
phpLister
 
Posts: 10
Joined: 1:28pm, Fri 21 Aug, 2009

Re: [add-on] Birthday Mailings

Postby brianstorm » 8:40am, Wed 26 Aug, 2009

i did try that... i didn't get it to work, although i'm sure with a little hacking you could....
Replacement Projector Lamps & Accessories in the UK
http://www.london-projectors.co.uk/projector-lamps.php
brianstorm
PL Geek
 
Posts: 138
Joined: 9:12am, Fri 26 Jun, 2009

Re: [add-on] Birthday Mailings

Postby brianstorm » 10:29am, Tue 29 Sep, 2009

Just a note for users... the version of this plugin which I have has a field to allow for changes of the number of days before the subscriber birthday to send them an email.. although this seems to update it appears that the default 7 days is actually hardcoded into birthday.php in the function evalDate which begins around line 141

It also looks like it sends emails to uncomfirmed users although I could be wrong about that bit...

I haven't as of yet got this plugin to run via cron (on php-cgi)...

It's a very useful plugin though - Great piece of work!
brianstorm
PL Geek
 
Posts: 138
Joined: 9:12am, Fri 26 Jun, 2009

Re: [add-on] Birthday Mailings

Postby ayoubpats » 10:18am, Wed 10 Feb, 2010

Hi Mates

try to use this plug in on phplist.am new to phplist.
I get this error Access denied HTTP 403
any suggestions .do i need to put the code in admin directory.
do i need to make any changes in the code.

cheers

Rida
ayoubpats
phpLister
 
Posts: 7
Joined: 8:39am, Mon 01 Feb, 2010

Re: [add-on] Birthday Mailings

Postby Dragonrider » 2:26pm, Wed 10 Feb, 2010

ayoubpats wrote:Hi Mates

try to use this plug in on phplist.am new to phplist.
I get this error Access denied HTTP 403
any suggestions .do i need to put the code in admin directory.
do i need to make any changes in the code.

cheers

Rida

Plugins are stored in the plugin folder, and accessed via the phplist admin control panel, down the bottom right hand side.

Oh, and don't forget to enable the plugins via the default line in lists/config/config.php file, using webspace or text Editor
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: [add-on] Birthday Mailings

Postby sukhajata » 1:06am, Fri 10 Dec, 2010

This shows how you can get firstnames which can be used to personalise your email message.
Code: Select all
<?php
class Recipient
{
   public $email;
   public $id;
   public $firstname;
   public $date_of_birth;
   
   function __construct($var1, $var2, $var3)
   {
      $this->email = $var1;
      $this->id = $var2;
      $this->date_of_birth = $var3;
   }
}
//a date_of_birth attribute has been created, which has attributeid 10.
//find users in list 2 that have birthdays within a week
$sql = "SELECT u.email, a.userid, a.value
      FROM phplist_listuser l
      LEFT JOIN phplist_user_user u ON l.userid = u.id
      LEFT JOIN phplist_user_user_attribute a ON u.id = a.userid
      WHERE l.listid = 2 AND a.attributeid = 10 AND DATEDIFF(a.value, CURDATE()) < 8";
$result = mysql_query($sql, $link);
if (!$result)
{
   die(mysql_error());
}

echo "Finding recipients" . "<br/>";

$recipients = array();

while ($row = mysql_fetch_assoc($result))
{
   $r = new Recipient($row['email'], $row['userid'], $row['value']);

   $recipients[$row['userid']] = $r;
}

var_dump($recipients);

//get the names of the people to send to. Firstname is attributeid 1
foreach ($recipients as $id => $recipient)
{
   $sql = "SELECT attributeid, value
         FROM phplist_user_user_attribute
         WHERE userid = " . $id . " AND attributeid = 1";
   $result = mysql_query($sql, $link);
   if (!$result)
   {
      die("Could not run query <br/>" . $sql . "<br/> " . mysql_error());
   }
   $row = mysql_fetch_assoc($result))
   if ($row['attributeid'] == 1)
   {
      $recipient->firstname = $row['value'];
   }
        //now something like...
       $message = "Happy Birthday " . $recipient->firstname;
      //and send message to $recipient->email
}


?>
sukhajata
phpList newbie
 
Posts: 1
Joined: 12:56am, Fri 10 Dec, 2010

PreviousNext

Return to Contributions: Plug-ins, Add-ons, Mods

Who is online

Users browsing this forum: No registered users and 2 guests