Add hooks and support for triggers

haffmans - November 1, 2009 - 00:04
Project:Donation
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

It would be useful to have support for hooks (and triggers) whenever a donation is made, so it's possible to have other modules do some extra stuff at such times.

Attached patch (against cvs HEAD) is a first (probably somewhat broken) attempt:
- it implements hook_hook_info() (to show the triggers)
- allows all user and system actions to be connected to the triggers -> this probably still needs some work, e.g. allow only specific actions, make sure parameters match properly etc.
- creates a hook_donation() which is called when a new donation is made.

The hook (hook_donation) currently distinguishes authenticated and anonymous donations through the $op parameter, mainly for the triggers display. Most of the donation info is not passed on; I suspect that may be a useful addition.

The action/trigger part is more or less optional (to me). As noted, it's probably still broken as not all user/system actions will be able to deal with the parameters properly.

#1

haffmans - November 1, 2009 - 00:06

Oops, forgot the patch :)

AttachmentSize
donation_trigger.patch 2.46 KB
 
 

Drupal is a registered trademark of Dries Buytaert.