0

I want to edit the message of the simplenews confirmation message when you unsubscribe from a newsletter.
It is the simplenews_confirm_removal_form but I can't track the code, to edit the message and the buttons' text.
Do you know where I can find it?

2 Answers 2

0

The button is present in the same function "simplenews_confirm_removal_form".

See t('Unsubscribe') & t('Cancel') in line below:

return confirm_form($form, t('Confirm remove subscription'), '', t('This action will unsubscribe you from the newsletter mailing list.'), t('Unsubscribe'), t('Cancel')

);

And the message is present under "simplenews_confirm_removal_form_submit" function.

drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => _simplenews_newsletter_name($form_state['values']['newsletter']))));

But if you want to change anything, editing it directly to the module is not advisable. The right way to do it is by using String overrides module or for hard coded way by using hooks, etc. by creating your own custom module.

3
  • Ok,thanks a lot! This function is at the subscription.inc file,right? You mean that an update can screw that? Also, I have a message override module, I will try one of those ways
    – Argiris A
    Mar 11, 2016 at 13:19
  • Yes, the file is simplenews.subscription.inc. The problem with direct coding is that things may go wrong while updating, especially when some other drupal guy take on the project. It is definitely not the best practice in drupal and should be avoided at all cost.
    – Titto Jose
    Mar 14, 2016 at 7:34
  • Thamk you for your answer!
    – Argiris A
    Mar 14, 2016 at 12:17
0

Sounds as if you need the String Overrides module. From the project page:

Provides a quick and easy way to replace any text on the site.

This includes messages as well. Here's what you would need to do:

  1. Extract to your sites/all/modules directory.
  2. Enable the module in admin/build/modules.
  3. Configure the access permission in admin/user/permissions.
  4. Visit admin/config/regional/stringoverrides and fill in the strings you'd like to replace. This is the string coming from Simplenews: %user was unsubscribed from the %newsletter mailing list.. Just change it to whatever you would like. You have the %user and %newsletter replacements available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.