Hi!

Still raining outside, so I have another feature request :)

It can be great when birthday module will works together with buddylist module.

So on each user profile, or each user birthday settings user can set
"watch every my buddies birthday and alert me 2, 1 days before, and on birthday date when my buddy will be have birthday"
so when any user buddy will be have birthday (or 1,2 days before),
this user got a standard drupal message (e.g. as private message info message ("you have new private message")
on this message can be e.g. "your buddy XXX will be have a birthday! don't forget on it, look here for more info"
or (if there will be more then one budy) "some of your buddies will be have birthday... " or "your buddies XXX YYY ZZZ will be have birthday, ..."

Or if it will be right on birthday date -> "Your buddy XXX has right now birthday, (if postcard is enabled) send to him/her a postcard..."
however, there are lot of options...
probably there will be needed to show birthday on list of buddies from birthday module instead new list with the same functionality.

On user birthday settings can be option "send me email notify (or if private messages will be enabled) private message notify when my buddy will be have a birthday (or x days before)"

Maybe will be great to create block with buddies and their birthday (sort by birthday)

Thanks ;-)
Igor
somvprahe.sk

Comments

maartenvg’s picture

Another great idea! It sounds like a large project, with a lot of options and choices to make. I like it though. I think this might become a seperate (but within the birthdays package) module to keep it clear.

I'll put it on ice for now because it will be a large job finding out how to (or creating a) hook into the buddylist module, but of course everybody is free to participate in this enhancement!

gagarine’s picture

track...

marcor’s picture

Assigned: Unassigned » marcor

I also imagine a block that - like the current upcoming birthday block - contains only the birthdays of a user's buddies. I'm quite familiar with buddylist (1.x), so I can do that. I can start at the beginning of 2008, not now, the end of the year is always a hurry.

liam mcdermott’s picture

Why not just integrate your module with workflow-ng (it's not difficult), then you'll have integration with any module. Well, any module that also integrates with workflow-ng that is, hopefully one day that will be all of them. :)

You also won't have to worry about depending on the buddylist module, and its API being a moving target.

marcor’s picture

Good idea. In the first moment, I thought filtering users by buddy-status is rather a question of joining tables than workflows. To reach that generally there should be views support. But you are right, when it comes to firing actions like sending e-mails that would be nice, too.

Is there already buddylist 1.x integration with workflow-ng? Personally, I don't have any background in any kind of (Drupal) workflows. So I won't be the one that will integrates workflow-ng with birthdays unless someone is a good teacher. Anyway, I think it's not a bad idea to provide some basic stuff that people can just use without the need to go deeper into usage of our wide-spanning Drupal mega-solutions like views and workflows.

liam mcdermott’s picture

Is there already buddylist 1.x integration with workflow-ng?

I doubt it, but we have to start somewhere. Pointing out that the birthdays.module integrates with workflow-ng may push them to do the same. :)

So I won't be the one that will integrates workflow-ng with birthdays unless someone is a good teacher.

I can help, can't provide patches though: am too busy to work out how to implement it fully, but can point you in the right direction. It would work something like:

/**
 * Workflow-ng hooks and implementing functions
 */

/**
* Implementation of hook_event_info()
*/
function birthdays_event_info() {
  return array(
    'birthdays_user_birthday_today' => array(
      '#label' => t('User birthday is today'),
      '#arguments' => array(
        'user' => array('#entity' => 'user', '#label' => t('User who has a birthday today')),
      ),
      '#module' => t('User'),
    ),
  );
}

/**
 * Implementation of hook_action_info()
 */
function birthdays_action_info() {
  return array(
    'birthdays_set_birthday' => array(
      '#label' => t('Set user birthday'),
      '#arguments' => array(
        'user' => array('#entity' => 'user', '#label' => t('User to update')),
      ),
      '#module' => t('User'),
      '#description' => t('Sets the birthday of a user'),
    ),
  );
}

/**
 * hook_action_info() callback
 *
 * @param &$user
 *   Reference to the user object
 * @param $settings
 *   Workflow-ng settings parameter
 * @param &$arguments
 *   Pointer to all arguments passed to the function from Workflow-ng
 * @param &$log
 *   Reference to Workflow-ng's internal log
 */
function user_stats_action_post_count_increment(&$user, $settings, &$arguments, &$log) {
  /**
   * This is called when workflow-ng sets the user's birthday
   * Insert code to update user's birthday here...
   */
}

Then you'd just need to add in some code to fire a workflow-ng event when it's the user's birthday, something like:

if (module_exists('workflow_ng')) {
  workflow_ng_invoke_event('birthdays_user_birthday_today', $user);
}

hook_cron() seems like a likely place for this to go.

****

Sorry for going on, but Token is another biggie that's quite easy to integrate with (workflow-ng uses it a lot too), try this:

/**
 * Implementation of hook_token_values()
 */
function user_stats_token_values($type, $object = NULL) {
  switch ($type) {
    case 'user':
    case 'all' :
      if (isset($object)) {
        $user = (object)$object;
      }
      else {
        global $user;
      }

      $values['birthday']  = check_plain(some_function_to_get_user_birthday($user));
      $values['age']         = (int) some_function_to_get_user_age($user);
  }

  return $values;
}

/**
 * Implementation of hook_token_list()
 */
function user_stats_token_list($type = 'all') {
  if ($type == 'user' || $type == 'all') {
    $tokens['user']['birthday'] = t('User birthday');
    $tokens['user']['age']        = t('Age of the user');
  }
  return $tokens;
}

Examples: this could be used to create a workflow-ng configuration. On a user's birthday it could send an e-mail (or Private message), that is tailored to their age. If they're over 30 it could send a joke about getting old. If they have a post count over 100 (in a forum scenario) and have logged-in within the last seven days an e-mail could be sent thanking them for their contribution and wishing them all the best on their birthday. If they've been signed-up for more than a month, but haven't visited for more than three weeks a birthday message could be sent pointing out what's new with the site and that they should come back and visit.

Actually the more I think about it, the more I want to use this functionality myself! What do you think? Do ask questions if you're not sure about anything... Oh, and the workflow-ng docs are at: http://drupal.org/node/156282

greggles’s picture

Note that for token your some_function_to_get_user_birthday needs to return a value that is safe to display in a browser (i.e. it's been passed through check_plain or a similar function).

liam mcdermott’s picture

Thanks for that Greggles, I've updated my comment accordingly. :)

marcor’s picture

There is a patch (new addon module in test state) that supports also notification of buddies. See http://drupal.org/node/177733

The initial question of sending a postcard can be supported by putting a link into the reminder message that points to page with the postcard form.

icecreamyou’s picture

+1 for this, and I agree that it would be better to make Birthdays work with Workflow-ng so it can also integrate with User Relationships etc.

Oh, and it's actually my birthday today. I got emails from all my websites thanks to this module. :D

socialnicheguru’s picture

subscribing

Niklas Fiekas’s picture

Status: Active » Closed (won't fix)

No new features into 5.x, unless someone writes a straight forward patch. I am not bumping this to 7.x because Buddylist doesn't have a Drupal 7 release.