Automatic Newsletter for SMF2

Started by HoverClub, March 31, 2012, 12:54:12 PM

Previous topic - Next topic

HoverClub

Link to the 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 subscription 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
  • Newsletter CSS styling can be edited in the SMF Language Editor
  • Newsletter can be previewed before activating.
  • If a users account is deleted any newsletter subscription they may have will also be deleted

Note that version 2.02 onwards uses functionality from the StopSpammer mod to check if a guest email isn't a spammer.  You MUST install StopSpammer and enable it before installing Newsletter.  Earlier versions of Newsletter can be used without StopSpammer being installed.


Note also 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->(your language name)->edit Languages Entries -> select "Modifications"
... find and edit the CSS string "newsltr_email_style"


Requirements:
PHP version 5.5 or higher
SMF version 2.0 or higher
StopSpammer mod installed and enabled

Note:
On some web hosts you may need to disable compression in SMF (if the newsletter 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.04
Optimised and updated the YoutTube video URL search functions
v2.03
fixed bug in mod to BoardIndex.template - remove redundant <table> tag
v2.02
uses StopSpammer mod (if installed) function to check if email from guest is a spammer
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 exclude 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 admin settings
v1.20
Cleaned up HTML format improving 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
....


OCJ

Several thumbnail images on the mod page are linked to the zip and not the images.

Interested to try this out though - thanks.

TheListener

#2
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.

HoverClub

Quote from: igirisjin on April 01, 2012, 03:24:07 AM
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?

Quote from: Old Fossil on April 01, 2012, 10:27:10 AM
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.


OCJ

I guess it was fixed ...
QuoteSeveral 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.

Bixby

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
Life is Short; Play Games!

OCJ

#6
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.

mikeymx5

I think that I have to agree I would love to have a test button.

HoverClub

#8
Quote from: Bixby on April 05, 2012, 11:17:58 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.

Quote from: igirisjin on April 05, 2012, 03:23:22 PMOne 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.

OCJ

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.

!RFAN

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

Quote from: !RFAN 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


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

How many times did you try and install the mod?


mikeymx5

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.

HoverClub

A little filename case issue  :-[ - now fixed and updated.

Alpay


OCJ

#15
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.

HoverClub

 
QuoteNot 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.

OCJ

#17
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:


QuoteI 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.

HoverClub

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?

timned88

I installed this and when I hit preview, I got the following error:

QuoteContent 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?

Advertisement: