I would like to be able to collect other fields when having people subscribe. For example First and Last Name, Zipcode.

Comments

sutharsan’s picture

Status: Active » Closed (duplicate)

Duplicate request. Please add you +1 to issue http://drupal.org/node/73364.

Bevan’s picture

Actually this is different to node/73364. The feature request in node/73364 is about fields that simplenews should generate and store in the DB (time stamp of events). This feature request is about fields that the subscriber should ENTER when they subscribe -- subscriber--attributes, such as the subscribers name, home-country, address, interests, etc. Ideally the webmaster should be able to define these fields. See how phplist http://phplist.com has implemented this feature.

This issue IS however a duplicate of http://drupal.org/node/130483.

mariuss’s picture

+1

and yes, this is not the same as node/73364

Adding at least a full name field for the user would be a good start.

dualdiesel’s picture

*bump*
*bump*
*bump*

ZIIIIIP COOOOOODES!
Please. If you can build it, I can pay.

yraber’s picture

I have used a small hack to do this : creating a new Webform component called "simplenews" and a few php lines that handles the subscription.

It's not really elegant, but it works. If someone is interested just send me a message, an I'll send you this. Right now I don't want to publish this here because it needs to be tested (I'm working on it).

yraber’s picture

Create a file called simplenes.inc in your module/webform/component directory and copy the code below.
You'll have a new Webform component called "simplenews". You can then select which newsletter this field should subscribe to.

This was not heavily tested at all, use it at your own risk.

<?php

function _webform_submit_simplenews(&$data, $component) {
  $news_vid = $data[0];
  $email = $data[1];
  if($email && $news_vid) {
    simplenews_subscribe_user($email, $news);
  }
}

function _webform_edit_simplenews($currfield) {
  if (!module_exists("simplenews")) {
    drupal_set_message(t("Using simplenews components in webform requires the <a href='http://drupal.org/project/simplenews'>Simpnews</a> module."), "error");
  }

  $edit_fields = array();
  $options = array();

  foreach( taxonomy_get_tree(_simplenews_get_vid()) as $newsletter) {
    $options[$newsletter->tid] = $newsletter->name;
  }

  $edit_fields['extra']['newsletter'] = array(
    '#type' => 'select',
    '#title' => t("Newsletter"),
    '#default_value' =>  $currfield['extra']['newsletter'],
    '#description' => t('Select which newsletter can be chosen'),
    '#required' => TRUE,
    '#multiple' => FALSE,
    '#size' => sizeof($options),
    '#options' => $options,
  );

  $edit_fields['mandatory'] = array(
    '#type' => 'hidden',
    '#value' => 1,
  );
  $edit_fields['extra']['description'] = array(); // Hide the description box

  return $edit_fields;
}

function _webform_render_simplenews($component) {
  $form_item[] = array(
    '#type'          => 'hidden',
    '#value'         => $component['extra']['newsletter'],
  );
  $form_item[] = array(
    '#title'    => htmlspecialchars($component['name'], ENT_QUOTES),
    '#type'     => 'textfield',
    '#required' => 1,
    '#validate' => array('_webform_validate_email' => array('submitted]['. $component['cid'])),
  );
  $form_item['#weight'] = $component['weight'];

  return $form_item;
}

function _webform_submission_display_simplenews($data, $component) {
  $form_item = _webform_render_hidden($component);
  $form_item['#value']         = $data['value']['0'];
  $form_item['#type']          = 'textfield';
  $form_item['#title']         = htmlspecialchars($component['name'], ENT_QUOTES) ." (hidden)";
  $form_item['#attributes']    = array("disabled" => "disabled");
  return $form_item;
}

function _webform_help_simplenews($section) {
  switch ($section) {
    case 'admin/settings/webform#simplenews_description':
      $output = t("Subscribe to newsletters.");
      break;
  }
  return $output;
}

function _webform_analysis_rows_simplenews($component) {  
  $query = 'SELECT data '.
    ' FROM {webform_submitted_data} '.
    ' WHERE nid = %d '.
    ' AND cid = %d';
  $nonblanks = 0;
  $submissions = 0;
  $wordcount = 0;

  $result = db_query($query, $component['nid'], $component['cid']);
  while ($data = db_fetch_array($result)) {
    if ( strlen(trim($data['data'])) > 0 ) {
      $nonblanks++;
      $wordcount += str_word_count(trim($data['data']));
    }
    $submissions++;
  }
  $rows[0] = array( t('Submissions'), $submissions);
  return $rows;
}

function _webform_table_data_simplenews($data) {
  return check_plain(empty($data['value']['1']) ? "" : $data['value']['1']);
}

function _webform_csv_headers_simplenews($component) {
  $header = array();
  $header[0] = '';
  $header[1] = '';
  $header[2] = $component['name'];
  return $header;
}

function _webform_csv_data_simplenews($data) {
  return empty($data['value']['1']) ? "" : $data['value']['1'];
}
katiebot’s picture

This sounds like a great idea & is exactly what I need. I have a problem though, the confirmation email just has newsletter/confirm/add, rather than newsletter/confirm/add/xxxxxxxxxxxxx. Does anyone have any ideas as to why this is happening?

Also, do you think it would be possible to put the Webform in a block?

Thanks for your work on this!

yraber’s picture

I had the same link problem but sadly I can't remember how I solved it :( But first try my new version, I there are a few bugfixes. And about the webform in a block , I have no idea.

Here is my last simplenews.inc :


<?php

function _webform_submit_simplenews(&$data, $component) {
  
  $news_vid = $data[0];
  $action = $data[1];
  $email = $data[2];

  global $user;
  $account = _simplenews_user_load($form_values['mail']);
  $confirm = $account->uid && $account->uid == $user->uid ? FALSE : TRUE;  

  if($email && $news_vid) {
    if($action == 'subscribe') {
      simplenews_subscribe_user($email, $news_vid, $confirm);    
    }
    else {
      simplenews_unsubscribe_user($email, $news_vid, $confirm);      
    }    
  }
}

function _webform_edit_simplenews($currfield) {
  if (!module_exists("simplenews")) {
    drupal_set_message(t("Using simplenews components in webform requires the <a href='http://drupal.org/project/simplenews'>Simpnews</a> module."), "error");
  }

  $edit_fields = array();
  $options = array();

  foreach( taxonomy_get_tree(_simplenews_get_vid()) as $newsletter) {
    $options[$newsletter->tid] = $newsletter->name;
  }

  $edit_fields['extra']['newsletter'] = array(
    '#type' => 'select',
    '#title' => t("Newsletter"),
    '#default_value' =>  $currfield['extra']['newsletter'],
    '#description' => t('Select which newsletter can be chosen'),
    '#required' => TRUE,
    '#multiple' => FALSE,
    '#size' => sizeof($options),
    '#options' => $options,
  );
  
  $edit_fields['extra']['newsletter_action'] = array(
    '#type' => 'select',
    '#title' => t('Newsletter action'),
    '#default_value' =>  $currfield['extra']['newsletter_action'],
    '#description' => t('Defines the action to be taken on submit'),
    '#required' => TRUE,
    '#size' => 2,
    '#options' => array('subscribe' => t('subscribe'),
                        'unsubscribe' => t('unsubscribe')),
  );

  $edit_fields['mandatory'] = array(
    '#type' => 'hidden',
    '#value' => 1,
  );
  $edit_fields['extra']['description'] = array(); // Hide the description box

  return $edit_fields;
}

function _webform_render_simplenews($component) {
  $form_item[] = array(
    '#type'  => 'hidden',
    '#value' => $component['extra']['newsletter'],    
  );
  
  $form_item[] = array(
    '#type'  => 'hidden',
    '#value' => $component['extra']['newsletter_action'],
  );
  
  $form_item[] = array(
    '#title'    => htmlspecialchars($component['name'], ENT_QUOTES),
    '#type'     => 'textfield',
    '#required' => 1,
    '#validate' => array('_webform_validate_email' => array('submitted]['. $component['cid'])),
  );
  $form_item['#weight'] = $component['weight'];

  return $form_item;
}

function _webform_submission_display_simplenews($data, $component) {
  $form_item = _webform_render_hidden($component);
  $form_item['#value']         = $data['value']['0'];
  $form_item['#type']          = 'textfield';
  $form_item['#title']         = htmlspecialchars($component['name'], ENT_QUOTES) ." (hidden)";
  $form_item['#attributes']    = array("disabled" => "disabled");
  return $form_item;
}

function _webform_help_simplenews($section) {
  switch ($section) {
    case 'admin/settings/webform#simplenews_description':
      $output = t("Subscribe to newsletters.");
      break;
  }
  return $output;
}

function _webform_analysis_rows_simplenews($component) {  
  $query = 'SELECT data '.
    ' FROM {webform_submitted_data} '.
    ' WHERE nid = %d '.
    ' AND cid = %d';
  $nonblanks = 0;
  $submissions = 0;
  $wordcount = 0;

  $result = db_query($query, $component['nid'], $component['cid']);
  while ($data = db_fetch_array($result)) {
    if ( strlen(trim($data['data'])) > 0 ) {
      $nonblanks++;
      $wordcount += str_word_count(trim($data['data']));
    }
    $submissions++;
  }
  $rows[0] = array( t('Submissions'), $submissions);
  return $rows;
}

function _webform_table_data_simplenews($data) {
  return check_plain(empty($data['value']['2']) ? "" : $data['value']['2']);
}

function _webform_csv_headers_simplenews($component) {
  $header = array();
  $header[0] = '';
  $header[1] = '';
  $header[2] = $component['name'];
  return $header;
}

function _webform_csv_data_simplenews($data) {
  return empty($data['value']['2']) ? "" : $data['value']['2'];
}

jphelan’s picture

This is close to what I'm trying to do. I'd like to add a check box to the bottom of my webform, that if checked will subscribe their email to a simplenews newsletter. For instance at the bottom of the contact us form it would say: Check here if you would like to join our Mailing List. Any thoughts? Anyway to tweak the above code to do that?

yraber’s picture

You can do this easily with the above code. Create your contact page as a webform and add a simplenews component (you have to copy the code into simplenews.inc in the webform/component directory).

mzabala’s picture

This worked like a charm! Except for one thing...

function _webform_submission_display_simplenews($data, $component) {
  $form_item = _webform_render_hidden($component);
  $form_item['#value']         = $data['value']['0'];
  $form_item['#type']          = 'textfield';
  $form_item['#title']         = htmlspecialchars($component['name'], ENT_QUOTES) ." (hidden)";
  $form_item['#attributes']    = array("disabled" => "disabled");
  return $form_item;
}

I wanted to be able to view the e-mail address of the submitting user along with the additional webform fields. I see it has been obfuscated, so I changed " $form_item['#value'] = $data['value']['0'];" to:
$data['value']['2'];

Now when I look at the webform results, it does give me the e-mail address used to subscribe to simplenews, however, the e-mail notification that is sent through the webform to the admin user responsible for the webform contains all the webform fields EXCEPT the e-mail address subscribing to the newsletter.

Any ideas why?

Also, I think this contribution would be very helpful with regards to extending Simplenews in the manner they are discussing here...
http://drupal.org/node/210846

pelicani’s picture

NOTE: the loading of the user into $account requires the field be named 'mail'

Since it uses the email, and above this line it specifically sets email, I recommend you change the line to the following...
$account = _simplenews_user_load($email);

UnicornSong’s picture

I have added simplenews inc to sites\all\modules\webform\components, and tried to add a simplenews component to my webform.

I receive this error message:
Call to undefined function _simplenews_get_vid()

Where is this function ( i have done a grep search in modules folder to no avail ) and how do i get this file to see it?

sutharsan’s picture

It has been removed as of 6.x-1.x-dev and replaced by variable_get('simplenews_vid', '')

UnicornSong’s picture

Sorry, I should have mentioned, I'm using Webform 5.x-2.0

UnicornSong’s picture

Thanks Sutharsan, I tried your suggested change in desperation and it worked. I guess the changes got ported over to 5.x-2.0 as well.
What a shame the client's requirements have changed and I dont need it anymore (well not for this project anyway)

einsicht’s picture

This worked great for me so far. It'd be nice to integrate it in the Webform module by default!

Thanks so much you guys!

k3vin’s picture

@jphelan: Did you find out a way to subscribe a newsletter with a checkbox in a webform?

In my webform i have already an email field with the email component. How can i use this email field for the simplenews component?
The above code use an extra textfield for the email address and validate this with the '_webform_validate_email' function.

Another question Is how can i skip the confirmation mail with the link to subscribe?

lucasb’s picture

Component: User interface » Miscellaneous

I too am trying to accomplish some kind of tighter integration between Webforms and Simplenews (i.e. the ability to include a checkbox in a custom form)...and I have found the effort quite frustrating. It is fairly common practice to include a checkbox on a website contact form offering the option of subscribing to a newsletter. It seems redundant to ask for a user's email address to subscribe to a newsletter, when you have already asked for an email address near the top of the form. I suppose the only other option would be to use the Simplenews textbox as the email box (however, this does not allow people to opt-out of subscribing to the newsletter).

It would seem a fairly simple modification to change the textbox input into a checkbox. However, the problem lies in retrieving the email address value from the specific field in the webform which collects the email address.

At least I know I'm not alone in this frustration...but I'm working on project now that really requires this feature, so that is small comfort.

Has anyone had any luck or even some small inspiration about this?

scottrigby’s picture

Hi, Has there been any progress on this for D6?

sgabe’s picture

I am trying to solve this problem too. I made a checkbox and an e-mail field like in yraber's code, but here comes the problem. The preg_match() function wait for a string, and in the _webform_render_simplenews function we have to create a form_item[] array for the textfield, wich contains the e-mail address, for the checkbox that controls the subscribe, and a hidden field with the newsletter taxonomy id. Because of the array, the e-mail doesn't contain the value of the e-mail address field and you can't set up the sender's e-mail address with this component...

Any idea how to solve this?

frost’s picture

Has there been any progress on solving this in a more flexible way?

callison’s picture

Component: Miscellaneous » Usability

What would you think of creating a new module ("Simplenews Personalize" for example) which could implement these features in a more user-friendly way? This module could then utilize Webform, Token, or whatever to collect user information (anon and registered) and display this in newsletters if desired.

I think this could be very powerful and flexible because it could allow for completely user-defined subscription forms and variables to place in the newsletters. You could then possibly even filter who to send the newsletters to based on this data, etc. I have been looking all over the issues and tons of people want this functionality. I'd love to hear any suggestions and I'd be glad to start working on this myself. Thanks.

callison’s picture

Status: Closed (duplicate) » Active

Changing status to active

sutharsan’s picture

You are very welcome to contribute code, but this should be an new module integrating simplenews with other modules. The feature is highly requested (as you have seen while digging through the issue queue). But be warned, this is not an easy thing to realize. It must be flexible and integrated with a number of different modules. I have some firm ideas on how this can be build. I you are serious to build and contribute this module I will share my ideas with you. Great fame will be your reward ;)

sutharsan’s picture

Referencing duplicate: #71710: Extend the Subscriber Form

callison’s picture

I may be in over my head, Sutharsan, but I'd love to hear your ideas and possibly get working on this. I'm thinking it would be best to start a new issue to discuss this idea. If you think that's the best way to proceed, I'll start the issue and try to get the ball rolling.

nimzie’s picture

If there is a new discussion on this, please reference it from here so I may follow. I'm quite interested in a working solution. Am just in to the "learning the ropes" part of Drupal coding with other coding experience to bring to the table.

sutharsan’s picture

@callison: This is /on/ topic, pls no new issue.
I will follow-on shortly with requirements and direction proposal.

@nimzie: you'r welcome to help. This is an 'all hands on deck' ;)

nimzie’s picture

I would be excited to help. I may need some direction as I haven't "groc'd" some of the "drupal way" of doing things.

Please keep me in the loop

sutharsan’s picture

Requirements:
* admin can define subscriber fields.
* flexible field definition (field type, required, default, select options)
* subscriber can enter data in subscription form. Applicable for both anonymous and authenticated users.
+ admin can assign fields to subscription form
+ subscriber data is available in views
* admin can list and maintain subscriber field contents
+ authenticated users can edit their subscription data
+ subscription data is synchronized with authenticated users profile
(* = required; + = optional/future)
The availability of data in views needs an additional note. For the future of Simplenews I want to make it possible for simplenews to send mailings to flexible target groups. The data collected by a view could be a target group. This would allow the admin to determine the target group by creating a view.

Solution:
* The subscriber field requires the flexibility of CCK
* Create a node type containing the system fields such as email. Admin can add additional fields.
* Use Content Profile module to use the subscription data as user profile data (option?)
* Create a user account for each anonymous subscriber just like Ubercart does this for anonymous webshop customers.
* Include node fields into the subscription form.

sutharsan’s picture

Version: 5.x-1.1 » 6.x-1.x-dev

This all could be build for simplenews 6.x in a new module. I'm prepared to advise or coach any one who want to write code for this. Alternatively I can devote my time to develop the module myself if a sponsor steps forward for this.

nimzie’s picture

I am hoping that with the knowledge I glean from this year's Drupalcon DC, I will be able to add valuable input to this job.

sutharsan’s picture

Title: Collect Other Fields » Collect subscriber data

Changing title.

giorgosk’s picture

Sutharsan,
If I understand well on your #32 comment you are proposing a solution that uses the "user profile" functionality for fields ? I am in favor of such a solution that integrates with user module ...

I am WILLING to split costs with a few other people to sponsor this development, can you come up with an estimated amount of how much would be appropriate for this development ? How about if you develop it such that these fields are exposed to the actual email send (i.e. for personalized emails, with name of the subscriber)

Anyone else willing to put some money for this development please post here or contact me (so we can calculate how much each one should pay ...)

BTW there is a similar issue with PATCH here http://drupal.org/node/87071

sutharsan’s picture

@GiorgosK: thanks for offering sponsorship. I send you a pm with a price and other remarks.

A solution based on profile fields is not as flexibility I would like it to be (access control, type of fields) therefore I prefer to use Content Profile module which is based on CCK and can be used as profile system too.

attiks’s picture

StatusFileSize
new2.99 KB

Attached you'll find the D6 version of #8 including some fixes as mentioned above (file simplenews_oldstyle.inc) and a new file simplenews.inc which displays all available newsletters as checkboxes, so people can select more newsletters at the same time. It's working for me, but please test this first before using on a live site :p

PS: Don't use both of them at the same time, I guess it will break things.

emdalton’s picture

We'd rather use CCK or similar for this, not profile, as we have people subscribing to newsletters who don't otherwise have an account on the system. We're willing to help fund. PM if you've got an estimate of cost. We are on Drupal 5.x until this summer, however, so we'll need this to be for 5.x.

pieterbezuijen’s picture

@yraber: Tnx for this fantastic fix:D Works like a charm.

@attiks: Uploading both files will give a fatal error. Deleting one is the solution :) Thanks for the handy ready-files.

When there is a test-version of a seperate module, I'm willing to test (and with my little knowledge) try to help debug.

marqpdx’s picture

Question:

what are you all doing w/ the subscriber data you collect? are you using it to personalize outgoing emails?

also, how are you getting the subscription setup. does that happen inside the webform?

thanks,
m

emdalton’s picture

We use this for personalizing contacts, and also for collecting information about which of several graduate programs the prospective subscriber is interested in. We don't have different newsletters for the different programs at this point, we just need to collect that info for other purposes. We're currently using webform and then manually importing the collected addresses into Simplenews, which seems very roundabout. We haven't been able to get the Simplenews webform component to work, and of course when using webform we no longer have the RSS subscription button, either. We also have to use nodeblock to get the webform into a block. It's very convoluted. :(

Jean-Philippe Fleury’s picture

Subscribing. It would be very nice and useful to be able to select recipients according to city or zipcode.

4ud’s picture

Thank you for the component with the checkbox, that is the one i try to use (post #37).
If i send my contact form (webform 2.4), unfortunately drupal 6.9 give me the following error:

warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /mydomain/drupal69/includes/database.mysql.inc on line 321.

I receive only the submited contact form datas via email, no subscription email.
can anyone help me out to fix this problem, please?

Many TIA, 4ud

iThinkWorks’s picture

subscribe

metabits’s picture

I am also very interested on having a bit more info of subscribers, like Name (in two fields as First Name an Surname would be better) and a couple of other ones like City, ZIP, Age/Date of Birth, Occupation so I could make statistics of people. Being also able to activate these fields or not (I have different needs from different sites) should be possible, I think.

Thanks for your work anyway !

psc

s.daniel’s picture

subscribing

sebastian.grow’s picture

@#45

Hey,

I had the same problem and it happend to be the following:

On the Form-Components of my Webform I did put the simplenews type into a fieldgroup, what messed the following code in simplenews.inc up:

line 9 was:

$email = $_POST['submitted'][$emailfield];

I named the simplenews field 'emailfield' and put it into the fieldgroup 'informations'. Then I changed line 9 to the following:

$email = $_POST['submitted']['informations']['emailfield'];

After this change it worked, email confirmation is sent out and email is subscribed.

Hope this is helping you as well..

Seba

lcampanis’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc6
Component: Usability » User interface
Category: feature » support
Priority: Normal » Critical

Hey guys,

Could someone please do a nice wrap-up of how to integrate this feature without hacking any modules.

The concept is to be able to have additional fields in simplenews for Anonymous/Registered users.

Lorenzo.

Jackinloadup’s picture

StatusFileSize
new4 KB

@kiela69
I attached the webform solution outlined in #8 (thanks). This has worked for me on 4-5 websites so far. Just remove the".txt" and place the simplenews.inc file in /sites/all/modules/webform/components/ p.s. Im running D6 with the latest stable for simplenews and webform as of (6/19/09)

@everyone
I must say though this solution is far from ideal. I think a CCK like solution would be ideal, but as subscriptions are not nodes i dont think/know if that would work.

Maybe instead we should take a vote and get the most common fields developers are wanting and include them?
i think first name & last name or full name are a given..

My reasoning for wanting this feature is to provide customized newsletters. I couldnt seem to find a way to pull the subscribers uid from within the template. If i was able to do that i could pull the other data i needed on the fly. Grated i know this solution would also not be ideal as we would be calling to the database far more often then necessary.

Ideas? comments?

lcampanis’s picture

Thank for this! I'll implement it on Monday and let you know.

My vote is ON, for a CCK-type interface for adding custom fields for collecting data. Now having it done on a newsletter basis (different data depending on newsletter) is probably for a later project.

Most common fields for me are: Firstname, Lastname, Country/Company

Lorenzo.

naught101’s picture

Version: 6.x-1.0-rc6 » 6.x-1.x-dev
Category: support » feature

@jackinloadup: "I think a CCK like solution would be ideal"

I think profile fields would make much more sense than the node system. The problem here is storing data for subscriptions that aren't users. Still, if you used the profile system, you could simply use the fields defined in the profile form, or even better, a fieldset of the profile form (e.g. contact details).

Storing data for non-users depends somewhat on what currently happens if non-users subscribe. Does the email address become associated with the new account? If not, then basically this module would require a whole new table for non-subscriber contact data. That might be true anyway though...

Jackinloadup’s picture

@naught101: "I think profile fields would make much more sense than the node system"

Wow, i dont know why i never thought of taking advantage of the profile system. I suppose maybe it was due to the non-user issue. But in either case.. still a very interesting idea. This would also allow any changes the user made to their profile to be reflected in their emails. ex: First name.

In this solution it seem almost unavoidable to create a new table to store user data. :-( This would need to get synced with the profiles sense some subscribers would become users after subscribing.

It sure seems like this would not be an issue in D7 with fields.

I suppose the next logical step is to see what kind of information this table should collect and how flexible we can make it. correct?

roball’s picture

Priority: Critical » Normal

I have posted an improved version of the new Webform component into Webform's issue queue at #525446: Public API for allowing other modules to provide components.

s.daniel’s picture

For the task to collect subscriber data through user/register this issue is relevant as well Mandatory Newsletter Option

naught101’s picture

There's a new module called "contact manager" that interfaces with the profile module. The current release doesn't work, but apparently should be fixed in a few days.

I've started an issue there that I think might cover this issue better for me, and would make more sense than pushing this functionality into simplenews: #531798: Interface with Simplenews

Anonymous’s picture

subscribe

haggins’s picture

subscribe

botris’s picture

Subscribe

tchopshop’s picture

I really need the subscription form as a CCK field. Webform will not work for me because I need a larger application form (with a subscription option) to be saved as a separate node, that can be manipulated by Views and Taxonomy.

I also need it to work for anonymous users, so hooking into profile is not as important to me.

I am very willing to pay for this functionality! Please contact me.

Elena

Alex Andrascu’s picture

+1

roball’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Sutharsan, are you planning to add this functionality to 6.x-2.x-dev?

sutharsan’s picture

No. Unless you have funds.

Alex Andrascu’s picture

I guess you had a sponsorship proposal for this one up to #35 AND some several patches to help getting this done. What happened with those? What do you mean by "No.Unless you have funds." Either you state your price or you just say you don't want to do this and let us help you.

Also you can consider this as a co-maintainership proposal.
Kind regards
Alex

sutharsan’s picture

alex, *all* patches in this issue are solutions using webform. Webform is flexible, but it is architecturally not a good solution. Subscriber data can not be modified, and it does not integrate with any other Drupal system (CCK, Views). I am open to patches, but I will not accept just any proposal. Most people only try to solve their own problem, I understand. But I also want protect the current and future maintainability of simplenews. I accept your offer for co-maintainership (as I accepted approx 10 offers in the past year) but then I expect you to stay committed for long time and not just for getting one feature in. A solid and flexible solution for collecting and using subscriber data will take some 60 hours of development. If we can agree on the architecture, I would love to see your contribution coming.

pcambra’s picture

I've just contributed a module that provides a simplenews component for webform 3.x http://drupal.org/project/webform_simplenews this allows creating custom forms and add a simplenews mail subscription component to them

sutharsan’s picture

pcambra, does your module make the data collected by webform available to simplenews in any form? What is your use case and how do you utilize the collected data?

pcambra’s picture

Hi Sutharsan

No, the module does not make available webform information to simplenews, I assume that you would like to use it as a token for the simplenews template or so?

Data is available & stored in webform's data schema.

sutharsan’s picture

lee20’s picture

Subscribing

sutharsan’s picture

claudiu.cristea’s picture

Try Views Send. It allows personalization and full recipient list filtering based on Views.

hixster’s picture

Is there any way with the above webform method to add subscribers names together with mass subscribe?

Tony_mc’s picture

Priority: Normal » Critical

I need this to insert the Name of the new subscriber into the Newsletter subscriptions list, is there anyway of doing this? Thanks.

sgabe’s picture

@Tony_mc: You can develop a custom module and implement hook_form_alter() etc. for collect any additional information you need. Since there is no easy solution in a general way (it needs to be flexible to add any kind of field e.g.), I did this myself too and it works great.

miro_dietiker’s picture

Priority: Critical » Normal

We also implemented this to have anonymous user names, but limited to customers' needs. Once we implemented higher priority tasks we'll also publish this module. However this will take some time.

BTW: Please don't set feature requests or questions to critical priority.

hixster’s picture

I did this myself too and it works great.

@sgabe , can you post an example of your solution ? It's seems a few of us are trying to get this functionality.

Tony_mc’s picture

Thanks for your help, I'll give this a go and see how I get on. Apologies for changing the priority

Tony_mc’s picture

@sgabe also it'd be great to see some kind of example of your solution. I am not the best of coders and struggling with this one!

MJD’s picture

I too would like to just be able to add a name field for personalisation of newsletters for anonymous users... i.e. a "simple news" module that gives the same basic subscription functionality that you can see on many many websites...

This seems to be the most duplicated request yet has been kicked around for what seems like years...but is still not available...

Does this module have a roadmap for the future where we can see if it will ever be implemented...

As the module has a new maintainer, if there isn't a roadmap can one be published so we can see if is worth waiting for (this request)...

Some people have obviously come up with alternative solutions, but I can't find any documented end to end solution for the rest of us... if anyone can point me (and others) in the right direction I would be grateful...

miro_dietiker’s picture

MJD, i'm the new maintainer.
We're currently checking next steps and working on a road map. Since bringing out a next major release is subject of >2 weeks of work this is a huge investment.

We'll be able to speedup development as soon as contributors participate development and provide sustainable improvements, projects contribute their customizations and make them generic, or projects provide funds for further module development.

Note that we already implemented this functionality for a custom project - but it takes much more time to make such a solution reliable and generic.. There's some refactoring done (see other issues) which will change some form handling. We'll delay new features and modules till the new form names get stable.

I'm very motivated to make this module a fully fledged extensible software that is comparable to
If none of the above happens, our strong commitment to drupal and simplenews will still lead to continuing progress, but don't expect any miracles.

Looking forward to see you supporting this modules' development.

pcambra’s picture

Maybe you could integrate http://drupal.org/project/webform_simplenews inside webform is that the idea?

MJD’s picture

Thanks for the update Miro...

Doesn't help with my simple needs at the moment but maybe in the future!

LeapFrog’s picture

Subscribing...

luksak’s picture

hi miro_dietiker

whats the status now?

would it be possible to integrate it with simplenews_register and profile? i need to pull the data from within the template for personalization.

thanks

lukas

miro_dietiker’s picture

Hi
simplenews_register is obsoleted now in 6--2.
The token setup will always be a separate module. Note that due to the token nature a customer specific solution might much more simple than a general one. This is also the reason why not yet a module exists.

Without any funds it will be too much work for us to force a community module for personalization: There's too much other work on simplenews currently -- before we start implementing completely new features.

luksak’s picture

hi

simplenews_register is integrated? if yes, is it possible to do this with the profile module?

the problem with webform_simplenews is that it only gives the user the possibility to register for one newsletter. but i need the checkboxes to choose which newsletter he wants to subscribe for. how difficult would it be to customize this module for this behavior?

would you recommend immediately using 6.2? how stable is it?

thank you

lukas

miro_dietiker’s picture

If u see at the issue tracker u will see that 6.2 contains a few critical bugs - since we're more focussing on dev speed than perfect repo quality. We're trying to fix the critical ones within the next few days.

6--2: just try it once. u will see that one can define which newsletter to use on registration...

Sure, Profile (and content profile) will be the only right solution to attach user fields. We just need a clean token replacement implementation for the profile fields in the simplenews domain.

However note that normally you will need custom combined token fields for the mail that combine multiple fields including salutation + name + family-name together with some logic to make the system work perfectly.

luksak’s picture

that sounds good.

am i able to use the token firstname?

what modules would you recommend to not let the user know that he registers for the site but not only the newsletter (no username, no password, no configmation mail, only for the newsletter?)

thanks

lukas

simon georges’s picture

Closing #443920: Personlized Newsletter (second) as a duplicate of this issue.

Andy B’s picture

Status: Active » Postponed (maintainer needs more info)

subscribe

Changing the status to postponed (maintainer needs more info) to reflect the real status. From what I understand, he wants to put it in but needs help in any way possible. I also need to have the user defined subscription fields and token placeholders for the content available. It's something that I can do without for now, but I will need it later. Whatever we do to make this possible, I would advise that it try to comply with local laws as much as possible. I am thinking US law ATM since I know more about it than any other country's laws but I'm sure the US isn't the only strict one out there. One of the main things I'm thinking of is what happens with the users info when it gets saved. Some if not most of it would need to be encrypted to protect privacy. I worry about anonymous subscriber data being pushed into the profile system:

1. The anonymous subscriber doesn't really have a profile until they create a sitewide account.
2. It would make more sense to me to have it in an anonymous_subscriber table until they create an account (at which time their anonymous subscriber info can be merged into their profile). Looks like the start of this has already happened by the sync user checkbox in the simplenews settings.

We also need to know that when someone unsubscribes, that their subscriber info is totally removed [anonymous users only]. So, relating this to the custom subscriber fields, does http://drupal.org/project/webform_simplenews allow for this? You delete a subscriber (anonymous or not) and the custom field data is removed as well? We would also need to know that when the person creates an account:

1. Their user defined subscription data isn't removed when unsubscribing
2. Everything related to the subscription is removed when an anonymous user subscribes.

Any ideas?

miro_dietiker’s picture

Andy B,
As long as simplenews supports anonymous subscribers, sure you'll need a subscriber based table with the additional fields asked for. This is something like an anonymous profile.

What we implemented is a table that adds certain fields to a snid like "name" and form_alter the subscription form.
The issue is you won't be able to use standard tools like profile and cck to extend this entity. (However in D7 we'd be able to make this entity fieldable..)

In addition you might implement the profile and node_profile token (which we also already started). Then - if you're asking users to signup you might use CCK or profile to add fields and expose them on registration.
Anonymous unsubscription is therefore handled by simplenews only. Note also that currently unsubscription leads to remaining persistence of the mail address and marking it unsubscribed. Only this way we can make sure that we won't reimport this unsubscribed client again.

The real issue is however the limitation of token as it doesn't provide any capability to map conditions into the personalized content.

Drupal itself was not compliant for clean unsubscription itself so i think it is quite common to start with a solution to persist data - and in a next step make it compliant.

Andy B’s picture

Are there plans for D7 to make the subscription base fieldable?

It's good to know that the email address is only marked as unsubscribed. We need to put that in the privacy policy. Not for sure how many people will like the idea that a website keeps their subscriber info even though they have unsubscribed. The general assumption here is that when you unsubscribe from something (for anonymous users), that all of your subscriber info gets "permanently deleted". I myself would be very annoyed that a website would hold my email address after unsubscribing based on an anonymous subscription. If I had a sitewide account, then holding it would make sense. Let me know what you think.

miro_dietiker’s picture

We're not currently working on D7 fieldability.
First we try to make D6--2 feature stable and cleanup things.

I agree what you say andy. This is always an issue for systems. The two things are in complete contrast:
- Make sure regarding SPAM policies that someone that hit REMOVE never will accidentally be added again by e.g. an address collector
- Be (?) compliant and remove everything related a subscription once a user hit unsubscribe.

Again: In my opinion we FIRST need to solve the SPAM-Issue. Then think about providing something like compliance application.

Andy B’s picture

Wish I could help out, but I really don't know php code that well. I have written code in .net though. Anyways, what do you mean by dealing with spam issues? If you are talking about people (like bots) signing up for the newsletter and filling the DB with useless users, just use the captcha module and put a captcha on the simplenews: [newsletter-name] block. This is more of a site design issue than a code/feature request issue. Don't try to reinvent the wheel. Protecting user data once it gets to the database is something simplenews possibly could help out with, but we would need to open another issue for that. To put a captcha on the signup form:

1. Install http://drupal.org/project/captcha
2. Make sure all of the settings are set the way you want. I made it show an add captcha link with every form on the website so I didn't have to hunt down the forms id numbes.
3. Enable simplenews block in administrate>site building>blocks and slide it wherever you want.
4. Visit the page where the signup block is and click the add captcha link. Set the settings.

Now, when someone goes to the form to signup for the newsletter, they have to solve the captcha first.

Like I said, if you mean something else with the "spam-issue" let me know so we are on the same page.

miro_dietiker’s picture

Andy B,
I was talking about following SPAM policies, not protecting us against SPAM.

Following SPAM policies means as written above - if users tell us to unsubscribe we MUST NOT send them again any bulk email ever. You could now choose between:
- A: persisting the mail address and marking it unsubscribed - and preventing it to be imported again
- B: or make sure to remove everything regarding the mail address (and unsubscribing this way)

Note that if you e.g. import weekly new subscribers collected from specific marketing actions, you will in case of B reimport again and the user will complain about you to be a spammer. Because he unsubscribed before and you readded him.

It is very likely that the same mail address will hit you in different imports through multiple channels. So if you want to be user friendly you NEED to start to MARK them unsubscribed instead of undelete them. All big companies follow this procedure.

Requesting to remove all data about a specific mail address / customer is a different process from this point of view.
I hope you can now follow my argumentation better.

Greetings - Miro

Andy B’s picture

Then what do you put in the privacy policy? Do you state that the user will be unsubscribed and all info will be retained (but if they want to be deleted just let us know)? Or do you just say that the user will be removed from the newsletter and leave it?

miro_dietiker’s picture

I think unsubscribe is the right word instead of remove. "Unsubscription" could then be understood as a process of persistency. In addition you could provide an application form to "remove" client specific data for privacy compliance.
There's no need to explain it more complicated or use different words IMHO.

Andy B’s picture

Got it.

ikeigenwijs’s picture

subscribe

palmaross’s picture

subscribe

Name field is very very very needed field for newsletters subscribers. 99% "professional" subscribe services have this field.
There is a HUGE difference treat your subscriber as "Dear noseke@gmail.com!" (or "Dear aFtr352!") and as "Dear Nicolas!". I think this is a HIGHEST priority issue of this great module.

Andy B’s picture

Guess we are on our own until the owner gets all of the dev bugs worked out. As he said before, he didn't plan on doing this in D7 either.

Sholex’s picture

suscribing...

stella’s picture

subscribe

thijsvdanker’s picture

subscribe

amateescu’s picture

sub

joehudson’s picture

I know a lot of people, including myself, have rolled their own custom solutions for this. I just went through all the relevant functions and incorporated an optional name field and added a name column to the DB. Maybe 10 hours work including the time I spent figuring out what functions did what.

Thinking about a solution that might be more general, what about having a special user role for simplenews subscribers and simply create an account and store the name (and any other info) in that? You'd need some hooks to control the sending of 'welcome new user' emails (so as not to confuse newsletter subscribers who didn't intend to open an account) and also some hooks to catch when the same person wants to actually register as a user, so that the same account that was created when they subscribed is updated and the role changed to 'regular user', or replaced with a new one. Does that make sense?

miro_dietiker’s picture

It was already once a topic discussed to switch to accounts for all registrations.
Drupal 7 goes much more into the entity architecture discussion. There's no need to become a user to be fieldable. Just make subscribers fieldable.

The question is, whether the concept of a subscriber is distinct enough from what a user is.

Sure there's some similarity between a user and a subscriber. Also between subscriber data and a users' profile.
But can we - and should we - simplify the situation to "every subscriber has an account", or are those two completely different entities?
Is the fundamental requirement of a user (the username) really given? (which means to me that users have the intention to authenticate and interact with the platform).

Note that introducing this similarity will change fundamental things and you will see that there's a lot of work to do. You'll need to refactor almost every aspect of the code.

joehudson’s picture

re the question of 'whether the concept of the subscriber is distinct enough from what a user is', I would say it is a distinct concept but not a disjoint one. 'users' in general can be anonymous, named (e.g. allowing named comments) or authenticated. In the broader sense, a subscriber is a user of the site that provides the newsletter. So I see no conflict with the idea that a subscriber is a type of user.

I guess the issue lies in how Drupal stores user info. Only authenticated users have their info like name, zip code, etc. stored with the account (in D6 at least). So now a subscriber would need to be an authenticated user to have their personal details stored - as far as I can tell. The question that comes to my mind then is, will the fact that the subscriber has an account that can be authenticated, but will not be until they actually express a desire to login, have a user name and password and take advantage of what authentication brings, cause any problems? Perhaps, so long there was a special subscriber only user role, with appropriately locked down permissions, there wouldn't really be much of a problem? That is, beside the job of refactoring so much of the code!

Going back to the relatively simple idea of basically adding a name field to the subscriber table. If that limited solution meets the needs of a large number of people using this module, without breaking existing functionality, and without requiring a huge time investment to implement, why not just do it? At least for the 6.x version. Both this and the user account approach could use the same 'get_user_data(sid, fields)' (or whatever) function calls, but with different implementations.

(It sounds like the solution in D7 will be a simpler job.)

MJD’s picture

I agree with that last point... provide people with what they want in D6....reorganise / rewrite for D7 if necessary

Requests for a "name" parameter for anonymous user subscription & email personalisation have been made for years...and fallen on deaf ears! This particular thread started in March 2007!

Many sites only offer newsletter subscription and no other interaction with visitors that need user accounts e.g. forums etc etc

With a module name like "Simple News" isn't it about time it provided "what it says on the tin" and provide the same functionality seen on many many other sites...

don't want to rant... so that's enough from me

miro_dietiker’s picture

Simplenews provides enough drupalism to simply allow you to put the name field on forms and add it on a separate table.

Regarding maintenance it is important to keep modules slim and extensible.
Instead of introducing a special case and another level of configurability, please simply write that simplenews contrib module and contribute it. You're right. This (name field only) isn't complicated.
6.x-2.x then can concentrate on the stability and extensibility, while a straight upgrade path is ready.

IMO: The pity is not that simplenews misses this functionality, but much more that no one implemented and contributed this module since 2007.

Adding this feature at the present time will slow down development and put more complexity in upgrade processes.

For the inputs provided i don't fully agree.
Logintoboggan e.g. adds a special user role that is pre-authenticated. This results in incompatibility with many modules that base on the core rule every user is either authenticated or anonymous. User authentication states will get much more complicated by adding different levels of pre-authenticated users. Since you're playing here with user state fundamentals this needs architectural consideration in depth.

sgabe’s picture

IMO: The pity is not that simplenews misses this functionality, but much more that no one implemented and contributed this module since 2007.

I am willing to publish my module which adds a name field for subscriptions if you are interested.

An overview about the features:

  • Adds a "name" field to the subscription forms. The !name can be used in the newsletters.
  • Displays the "name" on the subscription overview page next to the user name.
  • Allows to mass import and export subscriptions in John Doe;email@example.com format (one per row).
  • Adds a tab which allows to subscribe users with name one by one. (Maybe this should be removed.)

If you have your own solution maybe we can put together our ideas and publish a new module.

roball’s picture

I'm sure a lot of users are interested, so pls publish. Thanks.

haggins’s picture

Relating to #95 of miro_dietiker:

Following SPAM policies means as written above - if users tell us to unsubscribe we MUST NOT send them again any bulk email ever. You could now choose between:
- A: persisting the mail address and marking it unsubscribed - and preventing it to be imported again
- B: or make sure to remove everything regarding the mail address (and unsubscribing this way)

Why not just saving a hash of the "removed" mail address? Maybe it would require an additional "blacklist" table or so.
At mass importing you could check if a mail address is on your ignore list without saving any personal data (as long as we are in agreement that a hash of a mail address it not a personal information).

@sgabe
Yes, please publish your module. Thanks! :)

stevep’s picture

Yes, I'll second that. Please publish a module that allows Drupal to do what other systems do quite easily (not mentioning Wordpress)

Could someone tell me why this still remains an issue? It's quite bizarre that such a "simple" thing (the courtesy of addressing people by their names) remains missing.

hixster’s picture

+1 for a publish

sgabe’s picture

The module needs some work to be suited for publishing and I have a very busy next week, but I will try to finish it at the weekend.

oeN’s picture

subscribe

sgabe’s picture

I am pleased to announce that today I published Simplenews RealName on account of your request.

hixster’s picture

Title: Collect subscriber data, make subscriptions fieldable » Collect subscriber data
Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

Yay - go sgabe! Thanks for the hard work, i'm sure it will be appreciated by all simplenews users, i'm going to install the module asap ;-)

miro_dietiker’s picture

Title: Collect subscriber data » Collect subscriber data, make subscriptions fieldable
Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

Great, so closing this issue atm for D6.

Moving to D7 issue queue.

Jackinloadup’s picture

Title: Collect subscriber data » Collect subscriber data, make subscriptions fieldable
Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

For D7 I was thinking about the possibilities of being able to use entities, fields, and bundles. I'm not 100% clear on the limitations of these but this is my dream.

Fields on subscribers. This is a given. What if we could have field-able newsletters that extend the subscriptions. Let me give you a use case:

"Sign up to news in your area" - geo/zip field
"Sign up to news based on >insert node reference< "

The idea is that you could sign up for newsletter A but not have to fill out information for newsletter B.

This way admin dont have to collect information thats generalized to every user of the website.

This idea is in no way refined. I just want to get people talking. This might not be possible.

miro_dietiker’s picture

@jackinloadup
Bundles are per entity type - where a subscription is THE entity that is fieldable.
This means - all added fields are architecturally added to any subscriptions. Without any possibility to limit fields per newsletter subscription.

Note in general that i was talking about subscriber fields (meaning per subscriber and not per newsletter subscription).

Everything beyond this will add an enormous complexity which even might be beyond D7 fields capabilities.

Sutharsan previously suggested that making every subscriber a user might reduce complexity. Note that subscriber fields might be exactly the same as user fields. Thus you result in almost similar entities.

sgabe’s picture

@miro_dietiker: Would you please update the project page and add Simplenews RealName to the related modules?

miro_dietiker’s picture

Added it to the front page. Thanks for reminding me, sgabe :-)

pcambra’s picture

Can you add the Webform Simplenews Component as well?
Thanks!

miro_dietiker’s picture

@pcambra:
Added Webform Simplenews Component also. Please open a new issue if further discussions needed.
Can you please specify on the module frontpage for which simplenews version your module works? 6.x-1.x and 2.x have pretty general differences. If not yet done for 2.x, please retest it.

pcambra’s picture

Hi miro, thanks
I've got to retest it with simplenews 2.x, it should be compatible though, please see #871558: compatibility with simplenews 2.x

drizzi’s picture

hi miro_dietiker,

as far as i know german law is extremly strict about saving personal datas. if you unsubscribe to a newsletter, all the data about the subscriber has to be removed from the database.

could you pls. consider this in the development ?

thanks.

steffen

Jackinloadup’s picture

In response to drizzi, I wonder how practical it would be to have the option to keep personal data, or vise-versa.

miro_dietiker’s picture

drizzi,
First simplicity and stability, then compliance. I'll add this feature as soon as quality contribution provided. Drupal itself took a long way to become more compliant.

I consider adding a hash field to store the hashed unsubscription. However activating this hashing feature and removing the original mail address will be an option - not the default behaviour.
Since we have a lot of things to do in development, this feature will need funds to implement.

Find more on our strategy and priority here:
#964864: Roadmap of Simplenews 6.x-2.0 / 7.x

drizzi’s picture

hi miro,

thanks for the post. sorry for beeing late to answer. so we have to wait until we are able to use simplemail.

steffen

summit’s picture

subscribing, greetings, Martijn

d0t15t’s picture

subscribe

mattcasey’s picture

Subscribe

ckidow’s picture

Subscribe

molnitza’s picture

Subscribe

steeph’s picture

Subscribe

Bevan’s picture

nicolas bouteille’s picture

Hi here is how I solved the problem using Rules, Webform and Webform Rules. I wrote a short article thinking it might help some of you !

Simplenews - Saving additional fields along with email address using Rules and Webform

Nicolas

miro_dietiker’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Yes, one option is not to use/extend the subscriber entity but make it map 1:1 to users and extend the user entity.
That corresponds to the question i previously asked: Should we drop the (new) subscriber entity and claim a subscriber being a "simplified" user...
If you request to self-manage subscribers / subscriptions you soon realize that subscribers need authentication too.

We decided to introduce the subscriber entity and introduce mailing sequences to "authenticate" via mail validation.

rlmumford’s picture

Title: Make Subscribers fieldable » Make Subscribers fielable
rlmumford’s picture

Title: Collect subscriber data, make subscriptions fieldable » Make Subscribers fieldable
Status: Active » Fixed

It sounds like this issue is about making the Subscriber entity fieldable, which it already is in #1790184: Convert subscriber to an entity. Win!

I'm well excited about simplenews 2!

Title: Make Subscribers fielable » Make Subscribers fieldable
Status: Fixed » Closed (fixed)

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

ssoulless’s picture

Issue summary: View changes

Hello I do not see any option of add fields to suscribers... why is this fixed?

rlmumford’s picture

Hi Soulless, I don't know if there is a UI for adding fields to Simplenews Subscribers, but they are entities in the 7.x-2.x branch of simplenews so fields can be added to them programmatically.

ssoulless’s picture

Hooo great!. Could you show me the correct way of add those fields to suscribers?

I mean so in the suscribtion form is necessary to add the new fields with hook_form_alter ?

I will open a nuew issue requesting UI for this task.

ssoulless’s picture

Here is the issue open and active if someone interested we can work for provide a patch with the feature

https://drupal.org/node/2198705

ssoulless’s picture

Well after fight a lot with this poor module I gave up, and change to the Newsletter module, with this module I could create segmented campaigns successfully and the suscribers are very manageable entities, very similar to a normal user so you can add as many fields you need using the power of CCK.

Regards

zmove’s picture

Hi, this issue interests me

Actually, I only see a solution using webform. What about a core D7 field solution ? D7 already include fields into core, so I don't understand why all the solution provided needs simplenews. I would prefer to not install simplenews just to parameter newsletter blocks as I already use entity form to manage my forms.