Announcing subscribe2!
This plugin provides a comprehensive subscription management system for WordPress blogs. Visitors can subscribe and unsubscribe through a convenient web-based form. All requests require confirmation by email.
Administators can configure the email template used for new post notifications, as well the messages used for (un)subscription requests. Admins can also subscribe or unsubscribe users, as well as send out an email to all confirmed subscribers.
Download subscribe2-2.1.4.tar.gz
Download subscribe2-2.1.4.zip
This version integrates with the new WordPress 1.5 admin bar, while preserving backward-compatibility with WordPress 1.2.
This plugin now requires WordPress 1.5 or above.
You will also want to make sure you resolve bug 902!
Notable changes:
Once you extract the files and activate the plugin, you'll need to create a link somewhere pointing toward subscribe.php. You can manually edit your index.php (or sidebar.php or footer.php), or you could use the WordPress Links manager.
All user requests require a reponse to a confirmation email, to thwart hooligans trying to (un)subscribe people against their wishes. Those darned hooligans...
Thanks to aalex and BigJibby from #wordpress on irc.freenode.net for their troubleshooting assistance. Thanks also to everyone who's contributed to the development of WordPress.
UPDATE: I realized I had forgotten to update the permalink in the plugin's description field to point to this entry. While fixing that, I realized that I had also made a rather serious mistake in how I handle 1.2 users. I've fixed that as well, and am releasing version 1.5.1 to correct it. If you downloaded 1.5, please re-download 1.5.1!
UPDATE: Thanks to some great feedback, I've released version 1.5.2. The new features include: admin notification upon successful (un)subscribe confirmation, support for a comma-seperated list of categories that should not trigger an email announcement, and some general clean-up. The download links were moved up to the top of this post, and all updates will be appended down here at the bottom. Thanks for the feedback, and please keep it coming!
UPDATE: Version 1.5.3 fixes a minor oversight with the application of the CSS in the admin section. Prior versions applied the CSS to all admin pages, when they should have only included it on the Subscribers management page. subscribe.php is now theme-aware, too, for WordPress 1.5 users. It should pick up your header and footer, allowing you to better integrate the subscription page with your site.
UPDATE: Version 1.5.4 fixes a stupid mistake in 1.5.3 which would break WordPress 1.2 blogs. Sorry about that.
UPDATE: Thanks to Morgan for spotting a problem with the name and address used to send notification emails. Fixed. Also fixed is proper handling of blank or invalid data being submitted to subscribe.php.
Update Version 2.0.3: This is the long-awaited update! All messages are now controllable through the plugin's Manage screen. I've also tidied up options storage in the database, along with a few minor tweaks. Finally, this version includes a subscribe2.po file if you want to translate the administration screens to your native language.
If you're upgrading, you will probably want to RESET your options to the defaults, and then re-define them according to your tastes.
Update Version 2.0.4: Thanks to MarcoB for spotting a typo which broke sending excerpt-only messages. Fixed!
Update Version 2.0.5: Added strip_tags to plaintext email delivery, to remove HTML from post content included in the mail. Also added a check against the post's date to suppress notification of future-dated posts.
UPDATE Version 2.0.6: added Content-Type text/plain for plaintext mail delivery -- thanks Toto. Added manual override for batch delivery on Dreamhost (or other hosting providers). See the README for additional details about the new batching functionality. Many thanks to Wade Emmert and Joe Mezzanini for their patience and their assistance in testing this new functionality.
UPDATE Version 2.0.7: I incorrectly entered a comment in the 2.0.6 source (/ instead of //) which broke version 2.0.6 -- version 2.0.7 fixes this. Sorry about that.
UPDATE Version 2.0.8: Version 2.0.7 had two major mistakes. First, batch mode was incorrectly set to be the default mode of operation. Second, if less than one batch (30 subscribers) of recipients was present, nothing happened. Version 2.0.8 correctly sets the default mode of operation to non-batched mode; and it also correctly handles batching mode with less than 30 subscribers.
UPDATE Version 2.0.9: I've added the ability to supply a subject line for emails delivered to all subscribers through the Manage interface. If you don't care about this feature, there's no need to upgrade.
UPDATE Version 2.1.1: I finally figured out localization, and have modified both subscribe2.php and subscribe.php to support gettext translations. If you translate this plugin, please send me the .po and .mo files for your locale, and I'll make them available in the Subversion repository for others to download!
UPDATE Version 2.1.2: very minor tweak, to allow for translatable text on the HTML form buttons. You only need to download this if you plan on making a translation file.
UPDATE Version 2.1.4: This version (finally) gets right the use of the author's or admin's display name when sending update notifications. Also included are additional translation tweaks. German and Spanish translations are available! Thank you Michael and maira, respectively.
UPDATE Version 2.1.5: I am closing comments on this post. Please see the subscribe2 2.1.5 announcement for details. From now on, new releases will get new posts -- 260 comments is too many! ;)
About | Policies | skippy.net
require_once (ABSPATH . '/wp-admin/upgrade-functions.php');toif (! function_exists('maybe_add_column')) { require_once (ABSPATH . '/wp-admin/upgrade-functions.php'); }Anthony: The portion of the code that generates the link used in the confirmation email(s) looks like this:$link = get_settings('siteurl') . $_SERVER['PHP_SELF'] . "?x=" . $x;which first gets the base URL of your blog, as defined in your Options page. The $_SERVER['PHP_SELF'] is the name of the currently executing script, inlcuding path. So the quick fix would be to simply edit s2_send_confirmation() to look like this:if ('add' == $action) { // send an email with a link to confirm their address $x = "ax" . md5($email) . "x" . $id; $link = get_settings('siteurl') . "subscribe.php?x=" . $x; $body = str_replace("LINK", $link, $message['add_confirm_email']); } elseif ('delete' == $action) { // send an email with a link to confirm their address $x = "dx" . md5($email) . "x" . $id; $link = get_settings('siteurl') . "subscribe.php?x=" . $x; $body = str_replace("LINK", $link, $message['delete_confirm_email']); }I had used the variable in case someone wanted to rename the subscribe.php file, for any reason. What I should do is call basename($_SERVER['PHP_SELF']), to strip the path info. Thanks to both of you for the info. I'll fix it up and make a 1.5.2 release this weekend.// a comma-seperated list of categories that SHOULD NOT generate an email $categories_to_skip = "";Provide a comma-seperated list of category IDs you want to exclude. Any new post that is in any of the excluded categories will not trigger an email. Feel free to email me, if you still need help!if ( ($youremail == $email) || (preg_match("/" . $pattern . "/", $email)) ) { main('self'); }toif ((strtolower($youremail)) == (strtolower($email))) { main('self'); }stripslashes()on user-generated mail sent to subscribers. I'm putting the final touches on a major update, which I hope to release soon. This new version will only work with WordPress 1.5 and above.subscribe.phpfile calls it at the beginning. Simply editsubscribe.phpand move the line:get_sidebarfrom the top to the bottom, just aboveget_footerBe sure to enclose it in<?php ?>as needed. I'll keep your feature request in mind. Thanks!subscribe.php. I use a seperate file to handle all subscription activities to make sure that WordPress doesn't try to gobble up the submitted data by accident.wp-content/pluginsdirectory, according to the instructions on the WordPress codex.if ('post' == $s2['s2_excerpt']) { $content = $postdata['Content']; } elseif ('exceprt' == $s2['s2_excerpt']) { $content = $postdata['Excerpt']; } else { $content = ''; }I'm also looking into another problem: text-only mail sent by the script do not correctly display non-ASCII chars, such as accented letters. Not sure if it's a problem with PHP string manipulation funcs, or with mail();. Any ideas?mail()instead ofmb_send_mail(); but I'm not sure. If you have any suggestions on the matter, feel free to email directly.__FILE__constant doesn't get set properly on Windows servers. You could try replacing the__FILE__declaration on lines 20 and 21 with "subscribe2.php", and see if that works.get_sidebar()function insubscribe.php. The code looks like this, starting at line 77: but that doesn't work for Kubrick-based themes. Simply move theget_sidebar();line down, so that it is called just beforeget_footer();, on line 104. If you want to post without sending the notice to your subscribers, you have two work-arounds:- De-activate the plugin, make your post, then re-activate your plugin.
- Define a category to not generate notifications; post your item into that category; then edit your post and re-assign categories as needed. My plugin only executes when posting a new item, not when editing an already-posted item.
As for mass-mailing, that's already present. Click theManagemenu, selectSubscribersand scroll down.get_sidebar()template tag. Thesubcribe.phpfile in the archive you downloaded calls the sidebar first, before the main content; whereas a lot of themes (WordPress' default theme, among them) call the sidebar at the end, after the content. As for the mail delivery: the plugin is not a full-blown mailing list manager. As such, in order to protect the email addresses of subscribers from one another, my plugin sends the email to the blog admin, and blind carbon copies everyone else.subscribe2.pofile at all. If you're not using English, then you can use the .po file to create a .mo file, namedsubscribe2-xx_YY.mowhere xx_YY is the language locale you're using (like de_DE for German, for example). Stick the .mo file intowp-content/plugins/and the plugin should automatically translate the admin interface according to the language file you're using. This page might help explain a bit more. Slawek: there is no option for this plugin to send an email when a draft is saved. You could change line 14: add_action ('publish_post', 'subscribe2', 8); to usesave_postinstead, perhaps, but that will cause an email to be sent every time a post is saved, regardless of its post status. You'd need some conditional logic to check the status of the post if you only want to send emails on the Save Draft action. I think I see where you're going with this. Blog authors could write posts, but only be allowed to save them as drafts. When a drfat is saved, a blog admin is notified by email, and invited to approve the item for posting. That sounds like a great idea! If you get it to work, do please share it with the community!<a href="/subscribe.php">Sign up for email notifications whenever my blog is updated!</a>it should be:<a href="<?php bloginfo('wpurl'); ?>/subscribe.php">Sign up for email notifications whenever my blog is updated!</a>to allow for installations that has the blog on other host than the one with Wordpresssubscribe2.phplives in /wp-content/plugins/. D: please try the download(s) again. I re-organized my download directory today. Feel free to check here: http://www.skippy.net/download/plugins/subscribe2/$mailtext = "$subject$mailtext"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: ' . get_bloginfo('html_type') . '; charset='. get_bloginfo('charset'); }I add some text} else { $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; charset='. get_bloginfo('charset'); } $rec = "subscribers@your.host"; mail($rec, $subject, $mailtext, $headers);And the changes are:$mailtext = "$subject$mailtext"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: ' . get_bloginfo('html_type') . '; charset='. get_bloginfo('charset'); } else { $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; charset='. get_bloginfo('charset'); } $rec = "subscribers@your.host"; mail($rec, $subject, $mailtext, $headers);Thats prevent from sendig these stupid mail headers! If you like the changes you can update you best script... Byeuser_registerplugin hook, you could automatically add the user's email address to the subscribers list. If you write such a plugin, do please post about and send a trackback (or pingback) to this entry!<div id='content' class='narrowcolumn'>At line 101, insert another</div>. That should fix you up.Sign up for email notifications whenever my blog is updated!I've been trying to do this unsuccessfully. Do you need to fill in the entire blog file path before the "/subscribe.php" protocol above in order to get a working link? When I insert it into my link it doesn't work.maybe_add_columnis defined in/wp-admin/upgrade-functions.php. The error message clearly indicates that the problem is not with subscribe2, but withbriansthreadedcomments.php.subscribe.phparound line 77, if you need to change how it displays. You'll need to usetarget=_blankin your anchor tag.index.php, instead of keeping all the header elements inheader.php. I've cobbled together something that should work, but I will not offer any support on this. connections-subscribe/subscribe.php" onClick="window.open('/subscribe.php','Subscribe','toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=400, height=250'); return false">CLICK HERE to be notified of new posts!that solved all my problems :) i love this plugin. thanks for all your hard work!which normally translates to "/blog/index.php". When subscribe.php is loaded for my site, the action value becomes "/blog/subscribe.php". It's minor since it's unlikely someone will suddenly decide to search for something after deciding they wanted to subscribe, but it's still 'broken' nonetheless. Any suggestions? (Besides being a lot less wordy...) ;)searchform.phpfile uses this:action="<?php echo $_SERVER['PHP_SELF']; ?>", which POSTs to whatever page you're currently veiwing. I consider this to be a flaw in Kubrick. To resolve it, replace that action with/index.phpto force the Kubrick search form to POST to the WordPressindex.php.get_permalink() which in turn uses the permalink structure you've defined in Admin -> Options -> Permalinks. The permalink included in the notification emails should always be the same as those used in your blog display. Could you please forward to me a few examples demonstrating the problem?@import url( );If you take it out for testing purposes, it works just fine (for both IE+Firefox), however without any formatting of course. (*) I made a few changes and it seems (have no clue why) to have solved the problem for IE:get_header();needs to be replaces with (the empty lines seem to make a difference):... ?> (*) So this would be usable workaround, but I also noticed another anomalie now with Firefox. The confirmation page (fter clicking the confirmation URL) seems to get loaded two times in a row, since it always comes up with an error message. So the first time it would either add/confirm or delete the subscriber, the second time (with the same parameters) it produces the error message. Any idea, what part of the code would cause it load twice? Thanks very much. Oliver PS: The site is a friends site: http://www.cupocoffee.de, it's all German though.`http://sample.site/blog/?p=24`. One of the emails was quite lengthy, but one was extremely short. Just FYI.subscribe.phpshould live in the root of your WordPress directory. Do you have a link to your site where I can check this?get_sidebar()after the content. Please contact me by email about the problems you're having, and what we can do to diagnose it.post(or maybecontent) div down to at least the same length as your sidebar.divwith margins and or padding as necessary; you could use<p> </p>combinations for "empty" lines beneath the form; or you could modify the page to remove the sidebar altogether. Unfortunately, site design is not my strong point, so I won't be able to help too much. I just write plugins! ;)subscribe.phpwill continue to function for users whether the plugin is activated or not. Ralf: I'll look into this.subscribe.php.sidebar.phpmail()withphpmailer(). Let me know if it works, please! zz85: The link will be sent as a permalink in most cases. A bug in WordPress exists that causes problems generating permalinks from posts that were saved as Drafts prior to publishing. This should be fixed in the next version of WordPress. I'm not inclined to work around the bug, because plugins like Permalink Redirect solve the problem just as well. If sending HTML email from subscribe2, you can generate a hyperlink in your notification template:<a href="PERMALINK">PERMALINK</a>I don't have any plans to provide per-message overrides for sender names. Most users seem perfectly content with using either the post author's name or the blog admin name. To permit overrides introduces signficant complexity for very little benefit. Someone else wrote a plugin to subscribe all registered users to the subscribe2 update list. Give that a try. I'm hesitant to add this feature (even as an option) at this time.<div id="content">line, which is duplicated insubscribe.php. Try removing that div fromsubscribe.php, and see if that works.</div><!-- end CONTENT -->This is why I strongly dislike themes that break opening and closing divs between sections of the display.get_header()should return only those elements necessary for the header.get_sidebar()should return only those elements necessary for the sidebar. Because your main content area is split between header and sidebar, it will be harder for you to modifysubscribe.php.publish_postaction is executed when new posts arrive via postie. In theory it ought not be hard. Another option would be to use a service like Bloglet to convert the RSS feed to email updates.subscribe.phpand remove the call toget_sidebar(). I cannot offer much more assistance than that. Troubleshooting themes is not my strong-point, and I've already spent way too long helping just a few people fix their broken themes. Andy: I've not seen that particular problem before. Can you tell me a little more about your setup? Which version of PHP? What operating system? Does it work correctly if you reset and use the default template?subscribe.php; or I remove all theme support and require everyone to style it on their own. As such, I'll continue to support reasonably standard themes. If someone needs specific support for their theme, they should first seek assistance from the theme author, if possible. If that fails, the WordPress Support Forums may be able to help.get_header(),get_sidebar(), andget_footer()functions. If ShadedGrey does not use these standard functions, instead lumping all the layout code in index.php, then you'll need to manually copy that layout into subscribe.php in order to make it work.publish_postplugin hook for drafts. It is this bug that causes draft permalinks to be incorrect in the subscribe2 notifications. I'm pretty sure what you're experiencing is also related. The only real fix for me is to force subscribe2 to query the database again for all of the details about the new post. I'm hestitant to do this, because WordPress 1.6 should correct the draft bug, thereby allowing my plugin to correctly use the post cache. I guess WordPress 1.6 is far enough away that I can fix this now, and un-fix it later. I'll try to get a new version out soon, but I can't offer any specifics right now.