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
Comments
Comment #1
miro_dietikerReferring to discussion about resending newsletter
#936982: Clone of simplenews node that has been sent
Comment #2
miro_dietikerIf you look at clone.pages.inc you can find:
This means simplenews can react on the clone_node hook.
Attached patch was committed to cvs (1.220.2.59 and .60 - needed 2 commits). If something broken, please tell.
There won't be any backport to 6.x-1.x.
Comment #3
giorgoskworks as described
but
"save" and "preview" buttons have moved just below "More information about formatting options"
like their weight was changed
could it be related ?
Comment #4
miro_dietikerNope ;-)
We didn't do anything to the buttons with this patch. I don't see any possibility this could change something on the buttons...
Comment #6
anybodyThis also makes sense for 7.x versions. Is this patch contained there?
Comment #7
goose2000 commentedThis 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