Using triggers to add new user to a mailing list

by Kevin Nowaczyk   Last Updated January 13, 2017 01:03 AM

I would like the Mailman Integration module to add any new user to a mailing list. I enabled Triggers and created an action in PHP. I then assigned the action to execute when a new user is created. I can not figure out how to get the $user object for this new user though. I can get the object of myself, the logged in user using global $user, but how do I get the new user?

$user = [newly added user];
$mail = $user->mail;
$name = $user->name;
$uid = $user->uid;
$list_name = 'list';
mailman_integration_subscribe($list_name, $mail);
mailman_integration_set_user_option($list_name, $mail, 'fullname', $name);
mailman_integration_insert_users($list_name, $mail, 0, $uid);
Tags : 7 actions


Answers 1


I am not sure about how you've configured your environment but have you looked into this module? It appears to extend the rules a little bit.

https://www.drupal.org/project/user_mailman_register

Shane Birley
Shane Birley
January 13, 2017 04:48 AM

Related Questions


How to do both action and destination in same url

Updated April 16, 2015 20:03 PM

Alter action label

Updated May 20, 2016 08:03 AM

Actions Module Error

Updated August 15, 2017 17:07 PM