Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  Extensions and Distributions Support ::  Modules ::  Email on Birthday

Moderated by: Support Team

Bottom
Email on Birthday

  • Link to this postingPosted: 24.01.2005, 18:08
    Profile
    anim_chowdhury
    rank:
    Softmore Softmore
    registered:
     January 2005
    Status:
    offline
    last visit:
    29.01.05
    Posts:
    72
    I am using Anniversaire where user input there birthday. Now I want to automatically mail user to their supplied mailing address(if any) in core My Account area on their Birthday(from Anniversaire input).
    Sending Birthday wishes to user's private message folder will be nice addition!

    How to proceed?

    Or is there any module that supports birthday+email?
  • Link to this postingPosted: 25.01.2005, 01:56
    Profile Homepage
    aase
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    05.10.06
    Posts:
    147
    Hi,

    1) Find if any birthdates match todays date. To do that you will need to run an SQL query against the DB and see if it matches todays date ( I guess that query allready is made in the module )

    2) You need to send the result. That you can do by a mail() or what ever your server supports. This will have to go inside the if-test in 1) if ( dbdate == todaydate){ action goes here....


    3) Here comes the issue... As PHP is not runned by it self it needs to be activated. You can do this test in the module it self... to e.g check for birthday and write a 1 to a sent column or something. It will then be activated everytime someone uses the module ( the write to DB will prevent multiple mailsendings). But what if no-one uses the module for a day ???? well, then no mails will be sent. You can ofcourse to a backwards test.... and send a delay congrats...).... The alternative is to run a cron job at a certain hour each day. This will be cleanest and with less code. It is however a bit more tricky as you will need cron on your server, and know how to set it. When this is said, it is not that hard icon_wink

    All in all the answer is that what you seek is not hard to do... it will need some 10 lines+ of code.

    Regs

    StormS
  • Link to this postingPosted: 25.01.2005, 10:14
    Profile
    anim_chowdhury
    rank:
    Softmore Softmore
    registered:
     January 2005
    Status:
    offline
    last visit:
    29.01.05
    Posts:
    72
    Can I set PNtresMailer for this job? Can you shortly describe CRON?
  • Link to this postingPosted: 25.01.2005, 13:00
    Profile Homepage
    aase
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    05.10.06
    Posts:
    147
    1) Yes you can use pnTresMailer, you will need to make a plugin and the code will need to search a large part of the file as I guess you wouldn't send newsletter everyday ???

    2) CRON is just a way of making automated jobs possible. Most webservers/hosters offers cron and jobs to be runned each minute. It is a single line command that you will at to a crontab file that tells the cronsystem which file to execute and when.... You can run e.g every min, once a day at xx clock, once or twice a month... in short it is very customable.

    The cronline may look like this:
    Code
    * 5 2 * * /usr/local/bin/php /www/x/xxxx/www/modules/birthdays/birthdaysmail.php

    That will run each tuesday or so at 5 o'clock if I'm not wrong...

    You need to figure out if your hoster offers cron as a part of the package. Doing your request this way is the very best way of doing it.

    Regs

    StormS

Start ::  Extensions and Distributions Support ::  Modules ::  Email on Birthday

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula