Advertisement:

Author Topic: Automatic Newsletter for SMF2  (Read 90196 times)

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Automatic Newsletter for SMF2
« on: March 31, 2012, 12:54:12 PM »
Link to Mod

Description
Allows anyone (including guests) to subscribe to an automatically generated weekly, fortnightly or monthly email newsletter.  Guests need to enter their email address, registered members don't.  The subscription options shows above the board index and (optionally) during forum registration.

The Newsletter can optionally contain forum stats, the latest news item, recent topics list, upcoming events from the calendar, video links (included in posts), and recent picture from SMF Gallery or SMFhacks Multimedia Gallery (if either are installed) - the newsletter email always includes an unsubscribe link as required by law.

Features:
  • Newsletter can be subscribed to during initial forum registration or at any time
  • Newsletter frequency can be selected by the user when subscribing (weekly, fortnightly or monthly)
  • Frequency timer starts from when the user subscribes (to reduce server email load).
  • Subscriber can unsubscribe on the forum OR by clicking an "unsubscribe" link in the Newsletter.
  • Newsletter sub/unsubscribe options show above OR below forum list.
  • Newsletter is HTML formatted (includes plain text version) using forum name and logo image (styling can be edited).
  • Example Portal PHP block code included (to allow newletter subscription options to appear on any portal page (using a custom portal PHP block)

Admin Settings:
  • Allow guest to subscribe to the newsletter.
  • Use guest permissions when selecting topics, videos and pictures to include.
  • Choose position of Subscribe/Unsubscribe buttons (top or bottom of forum listing)
  • Chose whether subscribtion option is shown during forum registration
  • Number of recent topic titles/links to include in the newsletter (set to 0 to exclude topics from the newsletter)
  • Select which boards to exclude when selecting topics
  • Number of recent videos to include (set to 0 to exclude videos from the newsletter)
  • Select which boards to exclude videos from
  • Include SMF Gallery pictures
  • Gallery categories to ignore
  • Include basic forum stats
  • Include the latest news item (the SMF newsfader doesn't have to be enabled)
  • Include basic forum stats
  • Include calendar events
  • Manual subscribtion removal by email address - allows admin deletion of invalid or bounced emails
  • Newletter CSS styling can be edited in the SMF Language Editor
  • Newletter can be previewed before activating.
  • If a users account is deleted any newsletter subscription they may have will also be deleted

Note that unless you have selected guest permissions OR exclude some board(s) then the titles of (and links to) new topics that appear in ALL boards will be included in the newsletter even if the recipient does not have permission to read the topic post itself.  This can be used as a way to encourage forum or group membership by showing topic titles but not allowing access to the content.

To change the CSS styling of the newsletter:
Admin->Configuration->Languages->Edit Languages->(whatever your langueg is called)->edit Languages Entries -> select "Modifications"
... find and edit the CSS string "newsltr_email_style"


Requirements:
PHP version 5.2 or higher
SMF version 2.0 or higher

Note:
On some web hosts you may need to disable compression in SMF (if the newletter preview shows a blank page):
Admin->Configuration->Server Settings->General and clear enable compressed output option

Adding Newsletter Subscription to an SMF Portal block
You can add the newsletter subscription options on any portal page (if it supports custom PHP code blocks - EzPortal, SimplePortal, etc.)  After installing this mod, create a new custom PHP block in your portal (see portal instructions) and paste the code from the file portal_block.php, included in this zip package into the new block.

Updates:
v2.01
added auto newsletter unsubscribe to user delete function
fixed various mini-bugs
v2.00
now supports SMFpacks Multimedia Gallery images in addition to SMF Gallery
v1.27
fixed youtube video URL to detect https//
v1.26
added missing picture gallery exlcude cats to database
v1.25
added subscribe on register feature
v1.23
fixed portal_block.php syntax error
added more robust check for SMF Gallery
v1.22
fixed bug in video inclusion code (shows in error log)
added sample portal PHP block code
v1.21
fixed SMF_Gallery detection bug in adminsettings
v1.20
Cleaned up HTML format imporving email client compatibility
Newsletter can include SMF Gallery pictures and YouTube videos (from posts)
v1.14
Now works properly on forums with unsupported languages (reverts to english)
v1.13
moved newsletter CSS style to languages - can now be edited by an admin
....


License:
   Copyright 2012/2013 John Robertson
   Released under the GNU/GPL license

    This is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
« Last Edit: April 01, 2012, 03:10:16 AM by HoverClub »

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #1 on: April 01, 2012, 03:24:07 AM »
Several thumbnail images on the mod page are linked to the zip and not the images.

Interested to try this out though - thanks.

TheListener

  • Guest
Re: Automatic Newsletter for SMF2
« Reply #2 on: April 01, 2012, 10:27:10 AM »
Looks interesting.

Is there a way the mod can be used for particular membergroups only?

Rather than have the subscribe buttons in the same location as the news  fader (almost) imo it would possibly be better on a persons profile page.


The more I see the mod on the main board the more it is growing on me.
« Last Edit: April 01, 2012, 12:29:53 PM by Old Fossil »

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Re: Automatic Newsletter for SMF2
« Reply #3 on: April 01, 2012, 12:34:39 PM »
Several thumbnail images on the mod page are linked to the zip and not the images.
I don't see that - the images are linked to the SMF forum - got an example URL?

Is there a way the mod can be used for particular membergroups only?

Rather than have the subscribe buttons in the same location as the news  fader (almost) imo it would possibly be better on a persons profile page.

It couldn't be group specific AND allow guests to subscribe as guests don't have a profile.  The built-in SMF news stuff works reasonably well for normal registered users.  The subscribe display stuff could be put someplace else (I use it in a portal block) but it has to be fairly obvious or no-one would notice it.

This mod is was intended to drive traffic to your forum by sending regular "reminders" in the form of a newsletter) to those who visit infrequently.


Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #4 on: April 02, 2012, 02:52:38 AM »
I guess it was fixed ...
Quote
Several thumbnail images on the mod page are linked to the zip and not the images.

Every time I clicked the images it downloaded the zip, except the first image... at the time I posted the first message.

Offline Bixby

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
  • Guinness is Goodness
    • SaskGames on Facebook
    • @Sask_Games on Twitter
    • SaskGames
Re: Automatic Newsletter for SMF2
« Reply #5 on: April 05, 2012, 11:17:58 AM »
This is a great idea for a Mod. Thanks. A couple of questions/suggestions:

(1) Is there a way to preview the Newsletter that will be going out? As an Admin, I would like the ability to preview and perhaps control a bit of the content / format.

(2) Is there a way to see who has subscribed and who has opted out. We are working on a member engagement strategy with our forums and knowing / controlling the subscription list would be quite beneficial.

Thanks again for the mod.  I am very appreciative of the efforts of the SMF community with features and functionality.
Bixby
www.SaskGames.com
We WORK to help you PLAY!

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #6 on: April 05, 2012, 03:23:22 PM »
Quote
(1) Is there a way to preview the Newsletter that will be going out?

By testing ...

One thing I noticed, or didnt see. When I subscribed to the list as admin I wasnt showing up in the subscribed list in the admin section?

Perhaps a test preview button is a good idea - on a page or emailed to an input email address or to admin.
« Last Edit: April 05, 2012, 03:39:24 PM by igirisjin »

Offline mikeymx5

  • Semi-Newbie
  • *
  • Posts: 63
Re: Automatic Newsletter for SMF2
« Reply #7 on: April 06, 2012, 10:30:21 PM »
I think that I have to agree I would love to have a test button.

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Re: Automatic Newsletter for SMF2
« Reply #8 on: April 08, 2012, 03:36:50 AM »
...
(1) Is there a way to preview the Newsletter that will be going out? As an Admin, I would like the ability to preview and perhaps control a bit of the content / format.

(2) Is there a way to see who has subscribed and who has opted out. We are working on a member engagement strategy with our forums and knowing / controlling the subscription list would be quite beneficial.
A preview wouldn't show exactly what a member would get as the content depends on latest posts/events/etc.  - as each member subscribes at a different time they all get different versions.  Just subscribe, wait seven days and see  :).  The formatting is taken from the standard SMF2 curve theme and includes the current forum header image and the descriptive text is in Modifications.english.php.

A subscribed viewer list might be a useful addition but the concept of this mod is that it's end-user controlled.  The viewer decides whether they want or don't want the newsletter.

One thing I noticed, or didn't see. When I subscribed to the list as admin I wasnt showing up in the subscribed list in the admin section?
There is no subscriber list in the admin section for this mod.
« Last Edit: April 08, 2012, 12:18:52 PM by HoverClub »

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #9 on: April 09, 2012, 01:43:49 PM »
So the only way to tell how many people are subscribed if to dig in the sql file ... having no subscriber list is not good for people on shared hosting plans with email limits. At least if it uses default smf mailing it will throttle it so it doesnt exceed hourly limits. It doesnt help though if more important site mail is held up due to long queue - topic announcements with is default lower priority.

Would still be nice to see how many are subscribled.

2.
Having an admin test preview helps check that permissions are ok rather than wait for a live posting in a week ... and find out something was sent that shouldnt have been. As each board might be different and post timing different, it is not easy to check its working as required without a preview... until its too late when sent out live.

Offline !RFAN

  • Sr. Member
  • ****
  • Posts: 716
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #10 on: April 10, 2012, 11:13:42 PM »
after installation i got this error after redirection:

function ModifyNewsltrSettings($return_config = false) { global $txt, $scripturl, $context, $settings, $sc, $modSettings, $smcFunc; // get list of boards... $result = $smcFunc['db_query']('', 'SELECT id_board, name FROM {db_prefix}boards'); $boards = array(0=>$txt['newsltr_includeall']); // include all boards while ($row = $smcFunc['db_fetch_assoc']($result)) $boards[$row['id_board']] = $row['name']; // get total subscribers $result = $smcFunc['db_query']('', 'SELECT COUNT(*) AS c FROM {db_prefix}hcb_newsletter'); $c = $smcFunc['db_fetch_assoc']($result); $count = $c['c']; $smcFunc['db_free_result']($result); $config_vars = array( array('check', 'newsltr_stats'), array('check', 'newsltr_news'), array('check', 'newsltr_events'), '', array('int', 'newsltr_topic_count'), array('check', 'newsltr_use_perms'), array('select', 'newsltr_exclude_boards', $boards, 'multiple'=>true,), array('desc','newsltr_prev', 'text_label'=>'[' . $txt['newsubscribe_mod_preview'] . ']'), array('desc','newsltr_subscribed', 'text_label'=> $count . $txt['newsubscribe_mod_subscribed']), array('desc','newsltr_delete', 'text_label'=>'[' . $txt['newsubscribe_mod_delmail'] . ']'), ); if ($return_config) return $config_vars; $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=newsltr'; $context['settings_title'] = $txt['newsubscribe_mod_title']; // Saving? if (isset($_GET['save'])) { checkSession(); $save_vars = $config_vars; saveDBSettings($save_vars); redirectexit('action=admin;area=modsettings;sa=newsltr'); } prepareDBSettingContext($config_vars); }
Fatal error: Call to undefined function ModifyNewsltrSettings() in /home/XXXX/public_html/Sources/ManageSettings.php on line 219

TheListener

  • Guest
Re: Automatic Newsletter for SMF2
« Reply #11 on: April 10, 2012, 11:19:29 PM »
after installation i got this error after redirection:

f
Code: [Select]
unction ModifyNewsltrSettings($return_config = false) { global $txt, $scripturl, $context, $settings, $sc, $modSettings, $smcFunc; // get list of boards... $result = $smcFunc['db_query']('', 'SELECT id_board, name FROM {db_prefix}boards'); $boards = array(0=>$txt['newsltr_includeall']); // include all boards while ($row = $smcFunc['db_fetch_assoc']($result)) $boards[$row['id_board']] = $row['name']; // get total subscribers $result = $smcFunc['db_query']('', 'SELECT COUNT(*) AS c FROM {db_prefix}hcb_newsletter'); $c = $smcFunc['db_fetch_assoc']($result); $count = $c['c']; $smcFunc['db_free_result']($result); $config_vars = array( array('check', 'newsltr_stats'), array('check', 'newsltr_news'), array('check', 'newsltr_events'), '', array('int', 'newsltr_topic_count'), array('check', 'newsltr_use_perms'), array('select', 'newsltr_exclude_boards', $boards, 'multiple'=>true,), array('desc','newsltr_prev', 'text_label'=>'[' . $txt['newsubscribe_mod_preview'] . ']'), array('desc','newsltr_subscribed', 'text_label'=> $count . $txt['newsubscribe_mod_subscribed']), array('desc','newsltr_delete', 'text_label'=>'[' . $txt['newsubscribe_mod_delmail'] . ']'), ); if ($return_config) return $config_vars; $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=newsltr'; $context['settings_title'] = $txt['newsubscribe_mod_title']; // Saving? if (isset($_GET['save'])) { checkSession(); $save_vars = $config_vars; saveDBSettings($save_vars); redirectexit('action=admin;area=modsettings;sa=newsltr'); } prepareDBSettingContext($config_vars); }
Fatal error: Call to undefined function ModifyNewsltrSettings() in /home/XXXX/public_html/Sources/ManageSettings.php on line 219

Rather than use the quote bbc code woulda been more suitable.

How many times did you try and install the mod?


Offline mikeymx5

  • Semi-Newbie
  • *
  • Posts: 63
Re: Automatic Newsletter for SMF2
« Reply #12 on: April 11, 2012, 01:53:11 AM »
Code: [Select]
Fatal error: require_once() [function.require]: Failed opening required '/htdocs/SMF2/Sources/Subs-Newsletter.php' (include_path='.:/usr/lib/php5') in /homepages/27/d239035776/htdocs/SMF2/Sources/NewsSubscribe.php on line 35
Thanks for the update, Im getting a error when trying to preview, im looking into it but if you have any ideas.

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Re: Automatic Newsletter for SMF2
« Reply #13 on: April 11, 2012, 04:19:11 AM »
A little filename case issue  :-[ - now fixed and updated.

Offline Alpay

  • Language Moderator
  • SMF Hero
  • *
  • Posts: 3,612
  • Gender: Male
  • test
    • Personal Web Page
Re: Automatic Newsletter for SMF2
« Reply #14 on: April 11, 2012, 05:09:58 PM »
Good job , thank you ;)

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #15 on: April 13, 2012, 08:36:09 PM »
Like the preview ... and the layout.

I wasn't sure if it sent full details. Some boards have members only stuff but guest access is blocked by a mod - not permissions.
Wit just links that private data is protected. At least they see the topic titles.

Admin still cant see a subscriber list? You want it that way?
Might be cases where you want to delete junk or malformed addresses, bounced mail etc.

But I like it so far.

Maybe a screenshot on the mod download page of the preview would be a good idea so people can see straight away what the output is like.


[Preview Newsletter]

3 people are subscribed

[Delete a recipient from the mailing list.]


Seems odd ... there is a box to enter email to unsubscribe but I cant see anywhere the subscribed emails. Doesnt show the guest email I subscribed. And doesn't show Admins email when it is subscribed. Not sure how to unsubscribe someone if I cant see the emails.
And it doesnt show a user email that is subscribed.
« Last Edit: April 13, 2012, 08:47:39 PM by igirisjin »

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Re: Automatic Newsletter for SMF2
« Reply #16 on: April 14, 2012, 04:02:44 AM »
 
Quote
Not sure how to unsubscribe someone if I cant see the emails.
And it doesnt show a user email that is subscribed.
The only reason for unsubscribing someone is if their email address bounces - the admin is notified of returned emails so will have the email address.  The mod only stores email addresses (as it has to work for guests) - no user info is saved that would allow you to connect it to a registered user.

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Automatic Newsletter for SMF2
« Reply #17 on: April 14, 2012, 04:32:06 AM »
Uhmm, ok.

It doesnt allow for any kind of pruning - a lot of subscription lists will get overloaded eventually.  People tend not to unsubscribe but filter it as junk... or often Ive had people complain and ask to remove them rather than they do it.
Doesn't hurt to trim old subscriptions now and again. Or it would mean uninstalling, delete all mod data and start over, with all recent subscriptions lost.


Updated:


Quote
I don't know how you would decide who to unsubscribe (apart from bouncing emails) when you don't know whether they still want the newsletter?  If you just randomly delete subscribers then you may as well just clear all the data as you say.  If the subscriber list gets very large then it's a sign that the newsletter is doing it's job - maybe it would be better to look at why those people aren't visiting or participating?

Newsletter list do get large and old subscribers not interested often do not unsubscribe. One list I know (similar site)  just deletes addresses over 1 year old and if they want it they come back and register again. His server cant deal with emailing out thousands of messages every week when perhaps only 500 recent ones are truly interested.
« Last Edit: April 16, 2012, 04:47:03 AM by igirisjin »

Offline HoverClub

  • Jr. Member
  • **
  • Posts: 198
  • hoverclub.org.uk
    • The Hovercraft Cruising Club
Re: Automatic Newsletter for SMF2
« Reply #18 on: April 16, 2012, 03:17:52 AM »
I don't know how you would decide who to unsubscribe (apart from bouncing emails) when you don't know whether they still want the newsletter?  If you just randomly delete subscribers then you may as well just clear all the data as you say.  If the subscriber list gets very large then it's a sign that the newsletter is doing it's job - maybe it would be better to look at why those people aren't visiting or participating?

Offline timned88

  • Jr. Member
  • **
  • Posts: 360
    • The Magic in Pixels
Re: Automatic Newsletter for SMF2
« Reply #19 on: April 16, 2012, 01:55:41 PM »
I installed this and when I hit preview, I got the following error:

Quote
Content Encoding Error
          The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
Please contact the website owners to inform them of this problem.

Any ideas what happened?