Support » Plugin: Participants Database » [Plugin: Participants Database] Display birthday of the month

  • Resolved Sev


    Hello Roland,

    I would like to display on a post the list of people who have their birthday in the current month.
    I recognise that this filter seems not easy.
    The only way I found was to code something when sending a parameter like filter=’date=birthday’ and then code the PdB_list.

    Do you have a better idea on the way to handle that ?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign



    Dates are stored as UNIX timestamps, so you could filter for a range of values that correspond to the current month. You’d have to put something like this into your template and use the do_shortcode() function to generate the filter.

    For instance, if you wanted to show all the birthdays that were coming in the next month, you could do something like this in your template:

    $end_time = strtotime( date( 'd M Y' ).' +1 month' );
    echo do_shortcode( '[pdb_list filter="birthday>'.time().'&birthday<'.$end_time'"]' );


    Finally I did a small function with a shortcode that allows me to select how many days I want to seek for birthdays. It is maybe not the simplest/fastest way to do it but it works :

    function annif( $atts) {
    extract( shortcode_atts( array(
    		'how_many_days' => '7',
    	), $atts ) );
    global $wpdb;
    for ($i = 0; $i <= $how_many_days; $i++) {
        $day_shift = $i*24*60*60;
        for ($j = 18; $j <= 70; $j++) {
    	    $past_day=mktime(0, 0, 0, date(n,time()), date(j,time()), date(Y,time())-$j)+$day_shift;
    	    $results = $wpdb->get_results("SELECT last_name, first_name, date_birthday, private_id, responsible FROM wp_participants_database WHERE date_birthday=$past_day");
    	    foreach ($results as $result) :
                $compteur = $compteur +1;
    	    echo '<TR><TD align=right>', $j, ' ans : ', $result->first_name, ' </TD><TD><B>', $result->last_name, ' </B></TD><TD> <a href=sample-page/fiche-adherent?pid=', $result->private_id, ' target=_blank>', date(Y,$result->date_birthday), "/", date(m,$result->date_birthday), "/", date(d,$result->date_birthday), '</a></TD></TR> => ', $result->responsible, '<br/>';
    add_shortcode('annif', 'annif');

    Note that my variable $j seeks only for people from 18 to 70 years old as I don’t have younger or older.

    Hi,i have a small doubt.In which place to write the above menstioned code..Im also try to display my customer birthday date in my site

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Participants Database] Display birthday of the month’ is closed to new replies.