Just a quick question- on our site we want to autosubscribe users when they sign up (we collect various data including a subscribe CCK field). Is this possible with this module? Can I subscribe users currently in the DB?

Comments

davyvdb’s picture

Status: Active » Fixed

This is possible using some small programming on your own side in a custom module.

I'd advise you export and import the users from your db via excell in your mailing service (Mailchimp or Campaign Monitor). BTW. You need confirmation from these users that they want to subscribe to be legal.

Michsk’s picture

Ok this is still fixed, here is how. Made completely posible by Davy.

1) Download and install rules: http://drupal.org/project/rules
2) Download and install token: http://drupal.org/project/token
3) Update your /emf/emf.helpers.inc with following cvs: http://cvs.drupal.org/viewvc/drupal/contributions/modules/emf/emf.helper... (read the legend below)
4) Import the following rule in the rules module:

array (
  'rules' => 
  array (
    'rules_25' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_user_insert',
      '#label' => 'send user to mailinglist',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
        0 => 'EMF',
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#type' => 'action',
          '#settings' => 
          array (
            'code' => '$lists = array("YOUR LIST ID");

foreach ($lists as $lid) {
  // parse fields
  $field_values = emf_helpers_parse_field_values($lid, $account);

  $mail = "[account:mail]";

  // subscribe user
  emf_helpers_subscribe($mail, $lid, $field_values);
} ',
            'vars' => 
            array (
              0 => 'account',
            ),
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'code' => 
                array (
                  0 => 'account',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_custom_php',
          '#info' => 
          array (
            'label' => 'Execute custom PHP code',
            'module' => 'PHP',
            'eval input' => 
            array (
              0 => 'code',
            ),
          ),
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

Your all set.

davyvdb’s picture

Title: Auto-subscribe » Auto-subscribe action
Category: support » feature

This is now also available as an action for the core "actions" module. You can created advanced actions where you can select per action what lists needs to be subscribed to.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Odd Hill’s picture

Thank you for the snippet. Integration with the rules module would be even more helpful though