Campaigner

Effortlessly subscribe members of your site to Campaign Monitor mailing lists.

Buy Now

30 day money-back guarantee

Version
4.4.0
Works on
EE2
Only
$25

Extension Hooks

Campaigner includes a two extension hooks:

campaigner_should_subscribe_member

Parameters

The campaigner_should_subscribe_member hook is called with two parameters:

  1. An associative array of member information.
  2. An instance of the Campaigner_mailing_list class, containing information about the target mailing list, including the trigger field ID and trigger value. The Campaigner_mailing_list class definition can be found at third_party/campaigner/classes/campaigner_mailing_list.php.

Return values

The campaigner_should_subscribe_member hook handler must return a boolean value. TRUE tells Campaigner to subscribe the specified member to the specified mailing list.

Example hook handler method

/**
 * Handles the 'campaigner_should_subscribe_member' hook.
 *
 * @access  public
 * @param   Array                               $member_data
 * @param   Campaigner_mailing_list     $list_data
 */
public function on_campaigner_should_subscribe_member(
    Array $member_data,
    Campaigner_mailing_list $list_data
)
{
    // Perform some very clever calculations.
    return TRUE;        // Subscribe the member.
}

Example extension

A complete and functioning extension is available on our GitHub account.

The extension uses the campaigner_should_subscribe_member hook to implement a common Campaigner feature request: support for “multi-value” trigger fields.

The GitHub repository contains a README file, with further details.

campaigner_subscribe_start

Parameters

The campaigner_subscribe_start extension hook is called with two parameters:

  1. The ID of the member currently being processed.
  2. An instance of the Campaigner_subscriber class containing information about the current “subscriber.” The Campaigner_subscriber class definition can be found at third_party/campaigner/classes/campaigner_subscriber.php.

Return values

Your campaigner_subscribe_start extension hook handler must return an instance of the Campaigner_subscriber class.

Example hook handler method

/**
 * Handles the 'campaigner_subscribe_start' hook.
 *
 * @access  public
 * @param   Integer                     $member_id
 * @param   Campaigner_subscriber   $subscriber
 * @return  Campaigner_subscriber
 */
public function on_campaigner_subscribe_start(
    $member_id,
    Campaigner_subscriber $subscriber
)
{
    // Modify the subscriber data, if required.
    return $subscriber;
}

Documentation

Sign up for exclusive offers, tips, and previews

Subscriber-only special offers on our commercial add-ons, and sneak-peaks of upcoming releases.

No spam, not ever.

Copyright © Experience Internet. Read our Privacy Policy.