diff --git a/README.txt b/README.txt index 3ad2e16..0ac1967 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ DESCRIPTION ----------- Simplenews publishes and sends newsletters to lists of subscribers. Both -anonymous and authenticated users can opt-in to different mailing lists. +anonymous and authenticated users can opt-in to different mailing lists. HTML email can be sent by adding Mime mail module. @@ -12,7 +12,7 @@ REQUIREMENTS * For large mailing lists, cron is required. * HTML-format newsletters and/or newsletters with file attachments require the - mime mail or HMTL mail module. + mime mail or HMTL mail module. INSTALLATION ------------ @@ -29,19 +29,19 @@ INSTALLATION 3. ACCESS PERMISSION Grant the access at the Access control page: - People > Permissions. + People > Permissions. 4. CONFIGURE SIMPLENEWS Configure Simplenews on the Simplenews admin pages: - Configuration > Simplenews. + Configuration > Web Services > Newsletters. Enable new content types to use as newsletter: Structure > edit content type > Publishing options Add and configure newsletter categories: - Structure > Newsletters > Add newsletter category - Structure > Newsletters > edit newsletter category + Structure > Web Services > Newsletters > Add newsletter category + Structure > Web Services > Newsletters > edit newsletter category 5. ENABLE SIMPLENEWS BLOCK @@ -53,16 +53,16 @@ INSTALLATION 6. CONFIGURE SIMPLENEWS BLOCK Configure the Simplenews block on the Block configuration page. You reach - this page from Block admin page (Structure > Blocks). + this page from Block admin page (Structure > Blocks). Click the 'Configure' link of the appropriate simplenews block. - + Permission "subscribe to newsletters" is required to view the subscription form in the simplenews block or to view the link to the subscription form. 7. SIMPLENEWS BLOCK THEMING - More control over the content of simplenews blocks can be achieved using - the block theming. Theme your simplenews block by copying + More control over the content of simplenews blocks can be achieved using + the block theming. Theme your simplenews block by copying simplenews-block.tpl.php into your theme directory and edit the content. The file is self documented listing all available variables. @@ -71,7 +71,7 @@ INSTALLATION simplenews-block.tpl--[tid].php (for newsletter series tid) 8. MULTILINGUAL SUPPORT - + Simplenews supports multilingual newsletters for node translation, multilingual taxonomy and url path prefixes. @@ -89,7 +89,7 @@ INSTALLATION Use 'per language terms' for mailing lists each with a different language. Newsletters of different language each have their own tag and own list of subscribers. - + Path prefixes are added to footer message according to the subscribers preferred language. @@ -100,43 +100,49 @@ INSTALLATION 9. NEWSLETTER THEMING - You can customize the theming of newsletters. Copy any of the *.tpl.php + You can customize the theming of newsletters. Copy any of the *.tpl.php files from the simplenews module directory to your theme directory. Both general and by-newsletter theming can be performed. Theme newsletter body: simplenews-newsletter-body.tpl.php (for all newsletters) - simplenews-newsletter-body--[category machine name].tpl.php + simplenews-newsletter-body--tid.tpl.php simplenews-newsletter-body--[view mode].tpl.php - simplenews-newsletter-body--[category machine name]--[view mode].tpl.php + simplenews-newsletter-body--tid--[view mode].tpl.php - [category machine name]: Machine readable name of the newsletter category - [view mode]: 'email_plain', 'email_html', 'email_textalt' + [tid]: newsletter category term id (tid) + [view mode]: 'email-plain', 'email-html', 'email_textalt' Example: - simplenews-newsletter-body--drupal--email_plain.tpl.php + simplenews-newsletter-body--1--email-plain.tpl.php Theme newsletter footer: simplenews-newsletter-footer.tpl.php (for all newsletters) - simplenews-newsletter-footer--[category machine name].tpl.php + simplenews-newsletter-footer--tid.tpl.php simplenews-newsletter-footer--[view mode].tpl.php - simplenews-newsletter-footer--[category machine name]--[view mode].tpl.php + simplenews-newsletter-footer--tid--[view mode].tpl.php [category machine name]: Machine readable name of the newsletter category - [view mode]: 'email_plain', 'email_html', 'email_textalt' + [view mode]: 'email-plain', 'email-html', 'email-textalt' Example: - simplenews-newsletter-footer--drupal--email_plain.tpl.php + simplenews-newsletter-footer--1--email-plain.tpl.php The template files are self documented listing all available variables. + Depending on how the mails are sent (e.g. how cron is triggered), either the + default or the admin theme might be used, if one has been configured. + To prevent this, Simplenews supports the mail theme setting from the + mailsystem module (http://drupal.org/project/mailsystem). Install it, choose + the mail theme and the newsletter templates from that theme will be used no + matter which other themes are enabled. + Using the fields Display settings each field of a simplenews newsletter can be displayed or hidden in 'plain text', 'HTML' and 'HTML text alternative' - format. You find these settings at: - Structure > Content types > Manage display > Email - + format. You find these settings at: + Structure > Content types > Manage display. + Enable the view modes you want to configure and configure their display. 10. SEND MAILING LISTS - Cron is required to send large mailing lists. Cron jobs can be triggered - by Poormanscron or any other cron mechanism such as crontab. + Cron is required to send large mailing lists. If you have a medium or large size mailing list (i.e. more than 500 subscribers) always use cron to send the newsletters. @@ -154,7 +160,7 @@ INSTALLATION These settings are found on the Newsletter Settings page under 'Send mail' options at: - Administer > Site configuration > Simplenews > Send mail. + Administer > Configuration > Web Services > Newsletters > Settings > Send mail. 11. (UN)SUBSCRIBE CONFIRMATION @@ -162,13 +168,13 @@ INSTALLATION Upon confirmation the user is directed to the home page, where a message will be displayed. On the Simplenews subscription admin page you can specify an alternative destination page. - Structure > Newsletters > edit newsletter category > Subscription settings + Structure > Configuration > Web Services > Newsletters > edit newsletter category > Subscription settings To skip the confirmation page you can add parameters to the subscription URL. Example: [simplenews-subscribe-url]/ok When an alternative destination page has been defined the extra parameters will be added to the destination URL. - Example: [simplenews-subscribe-url]/ok + Example: [simplenews-subscriber:subscribe-url]/ok Destination: node/123 Destination URL: node/123/ok @@ -192,7 +198,7 @@ INSTALLATION vulnerable to Cross Site Request Forgeries. Email addresses may be (un)subscribed without a notice. Do not use this setting in uncontrolled environments (like the internet!). - + 13. TIPS A subscription page is available at: /newsletter/subscriptions diff --git a/simplenews.module b/simplenews.module index f233921..5a25c66 100644 --- a/simplenews.module +++ b/simplenews.module @@ -2563,6 +2563,7 @@ function simplenews_theme() { 'language' => NULL, ), 'path' => $path . '/theme', + 'mail theme' => TRUE, ), 'simplenews_newsletter_footer' => array( 'variables' => array( @@ -2573,6 +2574,7 @@ function simplenews_theme() { 'language' => NULL, ), 'path' => $path . '/theme', + 'mail theme' => TRUE, ), 'simplenews_filter_form' => array( 'render element' => 'form', @@ -2738,6 +2740,9 @@ function template_preprocess_simplenews_newsletter_body(&$variables) { unset($variables['build']['links']); unset($variables['build']['comments']); + $theme = function_exists('mailsystem_get_mail_theme') ? mailsystem_get_mail_theme() : path_to_theme(); + $variables['simplenews_theme'] = drupal_get_path('theme', $theme); + $variables['title'] = check_plain($variables['build']['#node']->title); // Add specific suggestions that can override the default implementation. @@ -2773,6 +2778,9 @@ function template_preprocess_simplenews_newsletter_footer(&$variables) { unset($variables['build']['links']); unset($variables['build']['comments']); + $theme = function_exists('mailsystem_get_mail_theme') ? mailsystem_get_mail_theme() : path_to_theme(); + $variables['simplenews_theme'] = drupal_get_path('theme', $theme); + // @todo Replace 'format' by 'view_mode ? $variables['format'] = $variables['category']->format; $variables['unsubscribe_text'] = t('Unsubscribe from this newsletter', array(), array('langcode' => $variables['language'])); @@ -3204,4 +3212,4 @@ function simplenews_impersonate_user($new_user = NULL) { */ function simplenews_revert_user() { return simplenews_impersonate_user(); -} \ No newline at end of file +} diff --git a/theme/simplenews-newsletter-body.tpl.php b/theme/simplenews-newsletter-body.tpl.php index a77df85..785c062 100644 --- a/theme/simplenews-newsletter-body.tpl.php +++ b/theme/simplenews-newsletter-body.tpl.php @@ -14,8 +14,7 @@ * Available variables: * - $build: Array as expected by render(). * - $title: Node title - * - $language: Language object - * - $view_mode: Active view mode. + * - $simplenews_theme: Contains the path to the configured simplenews theme. * * @see template_preprocess_simplenews_newsletter_body() * @see theme_simplenews_newsletter_body() diff --git a/theme/simplenews-newsletter-footer.tpl.php b/theme/simplenews-newsletter-footer.tpl.php index 7c3d023..25a224f 100644 --- a/theme/simplenews-newsletter-footer.tpl.php +++ b/theme/simplenews-newsletter-footer.tpl.php @@ -3,9 +3,9 @@ /** * @file * Default theme implementation to format the simplenews newsletter footer. - * + * * Copy this file in your theme directory to create a custom themed footer. - * Rename it to simplenews-newsletter-footer--.tpl.php to override it for a + * Rename it to simplenews-newsletter-footer--.tpl.php to override it for a * newsletter using the newsletter term's id. * * @todo Update the available variables. @@ -16,6 +16,7 @@ * - $format: newsletter format [plain|html] * - $unsubscribe_text: unsubscribe text * - $test_message: test message warning message + * - $simplenews_theme: Contains the path to the configured simplenews theme. * * Available tokens: * - [simplenews-subscriber:unsubscribe-url]: unsubscribe url to be used as link