Clone of simplenews node that has been sent

Created on 9 October 2010, over 14 years ago
Updated 14 October 2015, over 9 years ago

When you clone a simplenews node that has been sent (emailed), the clone node also has the status of being sent and so it cannot be sent again. I have a client who wanted to able to clone a newsletter so it could be sent to different newsletter groups. To solve this problem I have written a small custom module that resets the status and count of emails sent, could this be included as a feature in a future release

extract of code...


function module_form_alter(&$form, &$form_state, $form_id) {

  switch ($form_id) {
	
  case 'simplenews_node_form':
  
     if (stripos($form['#action'],"/clone") !== false) {
	
        $pnode = $form['#parameters'][2];
        $pnode->simplenews['sent_subscriber_count']=0;
        $pnode->simplenews['s_status']=0;
        $form['#parameters'][2]=$pnode;
		
        $node = $form['#node'];
        $node->simplenews['sent_subscriber_count']=0;
        $node->simplenews['s_status']=0;
        $form['#node']=$node;
     }
    break;
	
  default:
       break;
	
 }//switch

} //module_form_alter

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom davenyss

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States goose2000

    This issue still exists for the latest version Simplenews. Not sure if form_alter() is the right way to correct this in Drupal 10.

    dev-4.x 344532a
    dev-4.x 91c4849

Production build 0.71.5 2024