Allow other modules to add data to subscriptions

flobruit - July 15, 2009 - 10:54
Project:Inxmail Professional
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:flobruit
Status:needs review
Description

The inxmailprofessional_subscription module currently only transfers e-mail addresses to the inxmail server, but there is often the need to include additional data (real name, address, etc).

Additional data can come from many different sources which will be different on every website and will also differ between mailing lists, so rather than dealing with the data itself, inxmailprofessional_subscription should provide a hook allowing other modules to provide their own data mappings.

This simple patch adds a "hook_inxmailprofessional_subscription_data". A sample implementation of the hook could look like this:

function example_inxmailprofessional_subscription_data($email) {
  $subscriber = user_load(array('email' => $email));

  $data = array(
    'name' => $subscriber->real_name, // This could come for example from profile.module or content_profile.module
  );

  return $data;
}

This would allow developers to add their own custom mappings with a little helper module without needing to hack the inxmailprofessional modules.

AttachmentSize
inxmailprofessional_subscription_additional_data.patch1.32 KB

#1

flobruit - August 6, 2009 - 09:44

Note that you need to set your mailing list so that new subscriptions overwrite existing ones in order to be able to update subscriptions from Drupal using this patch.

It is not activated by default, but can be changed in the "Sub- & Unsubscription"-Agent in the Inxmail Professional Client (thanks to Stefan for pointing this out).

 
 

Drupal is a registered trademark of Dries Buytaert.