CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Birthdays
Pages: [1]

Author Topic: Birthdays  (Read 1447 times)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Birthdays
March 30, 2009, 11:28:57 am
I see there have been several discussions here and on drupal.org about either creating a birthday e-card feature for CiviCRM or integrating the Drupal birthdays module < http://drupal.org/project/birthdays >.

I would like to implement a solution, but I would like to ask for feedback as to what people think is the best way to implement this. Possibilities are:

1. Synchronize the birthdays table with CiviCRM data (either via cron or via a civicrm form hook)

2. Allow the birthdays module to directly access the CiviCRM birthdate data

3. Add this feature to CiviCRM itself

My guess would be #2, but I would like to hear what people think.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Birthdays
March 30, 2009, 12:22:05 pm

i'd vote for #2 :) cleaner and easier that way :). Would be good to do this for 2.2

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SemperFi

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 3
  • CiviCRM version: 4.5.4
  • CMS version: Wordpress 4.0.1
  • MySQL version: MySQL 5.5.16
  • PHP version: PHP 5.3.17
Re: Birthdays
April 12, 2010, 01:36:25 am
Hi,

Any news about this integration. Could be useful to have this function integrated in the user homepage or a block
For example :
 - by default for an admin, all the birthdays +/- 10 days compared to D-Day
 - and/or all the birthdays of the contacts an user is in relation with +/- x days

Thks in advance for the feedback on this topic.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Birthdays
April 12, 2010, 03:29:04 am
It would be a nice dashlet indeed.

Are you willing do give it a try?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Birthdays
April 12, 2010, 03:21:04 pm
By dashlet - I suppose you could do a civireport & make that a dashlet?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Birthdays
April 13, 2010, 02:15:14 am
Code: [Select]
[code]Haven't used templates. is there a way of creating a template and call it directly ?

To let you started, this what I did to fetch all the contacts that have their birthday today

In a template
[code]
{crmAPI entity="contact" action="birthday" var="older"}
<div id="birthday">
<h3>{$smarty.now|date_format:"%A, %b %e"}, Happy Birthday</h3>
{foreach from=$older item=member}
<li>{$member.sort_name} is {$member.age} years old today</li>
{/foreach}
</div>

and added a function into api/v2/Contacts.php

[/code]
function civicrm_contact_birthday ($params) {
{
  _civicrm_initialize( );
  $query="select id,sort_name, first_name,last_name,image_URL,birth_date,(YEAR(CURDATE())-YEAR(birth_date)) as age
 from civicrm_contact where MONTH(birth_date) = MONTH(CURDATE()) and DAY(birth_date) = DAY(CURDATE()) and contact_type = 'Individual'";
  if (array_key_exists ('contact_sub_type',$params)) {
    $query .= ' and contact_sub_type = "'.$params['contact_sub_type'].'";';
  }
  $dao =& CRM_Core_DAO::executeQuery( $query, CRM_Core_DAO::$_nullArray );
    $n = 0;
    while ( $dao->fetch( ) ) {
      foreach ($dao as $k=>$v) {
        if ($k[0] != '_')
          $contacts [$n][$k] = $v;
      }
      $n++;
    }
    $dao->free( );
    return $contacts;
}

[/code]

As an aside, Tamsin got hers yesterday, and mine was on friday. Happy birthday ;)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Birthdays
April 13, 2010, 02:30:33 am
Happy Birthday, and for Tamsin too!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Birthdays

This forum was archived on 2017-11-26.