Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

  • Ben April 2013
Drupal RULES to autosubscribe new users
  • Vote Up0Vote Down njwrigleynjwrigley
    Posts: 32Sendy user

    Hi there,

    For those using Drupal. If you would like to autosubscribe users you can use the following in the Rules module.

    Set up a new Rule > Event: After saving a new user account > Action: Execute custom PHP code

    Copy the following code into the box:

    $postdata = http_build_query(
    array(
    'name' => '[account:name]',
    'email' => '[account:mail]',
    'list' => 'your_list_key_from_sendy_backend',
    'boolean' => 'true'
    )
    );
    $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
    $context = stream_context_create($opts);
    $result = file_get_contents('http://your_domain.com/subscribe', false, $context);

    //CHECK RESULT if($result) echo true; else echo false;


    Note: YOU NEED TO ADD YOUR LIST KEY AND DOMAIN INTO THE CODE ABOVE!
    You don't need any conditions in the Rule.
    You don't need <?php ?> tags in the code
    This does not allow the user to express their permission to get signed up to your list, so you might find that there are quite a few unsubscribes - in my case this will not happen, as I tend to personally know my users, but just be aware. A way around this might be to add an autoresponder after 0mins with an unsubscribe link in.


    Idea from @Ben: http://snipt.org/vhfha3

  • 1 Comment
  • Vote Up0Vote Down BenBen
    Posts: 3,494Sendy support

    Thanks for sharing!

This discussion has been closed.
All Discussions