I too, wanted this feature. It is vital to me for a client. Since there seemed to be nothing, I decided to do it myself.
So with a BASIC understanding of PHP (but I'm learning), I wrote something. It's really a hack, but it works.
With the code (below), you have to define your html page, which is your birthday wish (and drop it in the same directory or build the path to it), as well as some email address stuff and of course your database names, etc. I have CAPITALIZED the stuff that should be changed.
I have tried this out, and it will send the HMTL message, and display it also as a text email for those that can't get HTML.
There are a couple of things to keep in mind... This is not personalized...so if anyone out there has a thought as to how to personalize the greeting, I would really appreciate it.
Second, you actually have to run this page in a browser to make it work. I would suspect you can run it in a Cron Job, but I don't know how to do that...so I'd appreciate some instructions if anyone has some...
Third, this was built reading a MySQL database on a Linux server with a PHPList install of 2.10.3.
Lastly, this does not produce a report. I think it would be great if someone can make it create a report , and have that emailed to the administrator. I could do that, but I have some other things to get to. At least this will work for the time being.
- Code: Select all
<html>
<head>
<title>Birthday Test</title>
<meta>
<?
$dbh=mysql_connect ("localhost", "DATABASENAME", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("DATABASE");//not sure why this is here again :(
$sql = 'SELECT * FROM `phplist_user_user_attribute`';
$result=mysql_query($sql);
$num=mysql_numrows($result);
mysql_close();
$dbh=mysql_connect ("localhost", "DATABASENAME", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("DATABASENAME");
$sql = 'SELECT * FROM `phplist_user_user`';
$emails=mysql_query($sql);
$total=mysql_numrows($emails);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$today = mktime(0, 0, 0, date("m"), date("d"), date("y"));
$i=0;
$count = 0;
$success = 0;
while ($i < $num) {
$id=mysql_result($result,$i,"attributeid");
$test=mysql_result($result,$i,"userid");
$birthday=mysql_result($result,$i,"value");
$month = substr($birthday, 5, 2);
$day = substr($birthday, 8, 2);
if ($id == 1){
$firstName = $birthday;
}
if ($id == 11 && $month == date("m") && $day == date("d")) {
$j=0;
while ($j <total>
</head>
<body>
</body>
</html>
Credits go to the people who put up PHP instructions on the net with examples, and anyone else who's code I stole.
And now the only other thing that I need, that I can't find, that I guess I have to do myself, is to get Wordpress to read the PHPList database to allow people to make comments.
Members of PHPList should be able to post comments on Wordpress without having to register there too. Any thoughts?
I have found nothing on Google for this, so if someone has anything, I would appreciate it.
Otherwise, enjoy your birthday function!
rob