Subscribe to Category

Deskripsi

This plugin lets a user subscribe and unsubscribe to posts within a certain category or categories.
Subscribers will recieve an e-mail with a link to the actual post. E-mails to subscribers are sent once every hour (adjustable) with WP Cron.

The HTML form is prepared for Bootstrap framework.

Subscribers are saved as a custom post type with a possibillity to export and import(excel/csv). Unsubscription needs to be confirmed by the subscriber.

The following settings and features are available for the administrator in current version:

  • Change e-mail sender from default
  • Change the title/subject for e-mails
  • Choose between classic/gutenberg editor output
  • Set the reschedule time for the cron job
  • Turn CSS on/off
  • Export subscribers to a tab delimited CSV file with a possibility to filter by categories
  • Import subscribers from a tab delimited CSV file (with the same format as created by the export function) with a possibility to filter the categories
  • Run the cron job manually so it will fire immediately
  • Theres a note when next scheduled event for sending e-mails to subscribers is running.
  • Options for leave no trace – deletes post meta and subscribers created by this plugin.
  • Option for re-send a post on update that has already been sent.
  • Implementation by widget or short code.

What Translations are included?

  • Dutch
  • Inggris
  • Perancis
  • German
  • Italia
  • Japanese
  • Lithuania
  • Norwegian
  • Rusia
  • Spanyol
  • Swedia

Have you translated this plugin to another language or updated a translation? Please send me your (po) files to sidney@vandestouwe.com and I will add them to the plugin. In that case I will create the json file(s) associated with the PO file

Tangkapan Layar

  • Settings page.
  • With Bootstrap framework.
  • Without Bootstrap framework, override and add your own css.
  • When resend post is enabled in settings there is a new option available when editing a post.
  • When resend post Gutenberg editor settings are both enabled, Resend options are available in the Gutenberg document tab

Pemasangan

This section describes how to install the plugin and get it working.

  1. Upload subscribe-to-category to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress Admin
  3. Save your settings ‘Settings > Subscribe’.
  4. Create a page and add shortcode [stc-subscribe] or use the STC Widget to display stc form subscription.

Shortcode Attributes

‘category_in’ – Use this attribute if you only want one or several categories to be available for subscription. Value to be entered is the name of the category.
‘category_id_in’ – The difference to above is to use the category ID instead of category name.

‘category_not_in’ – Use this attribute if you want to exclude categories to be available for subscription. Value to be entered is the name of the category.
‘category_id_not_in’ – The difference to above is to use the category ID instead of category name.

For the above attributes you can use a comma sign to separate multiple categories, like [stc-subscribe category_in=”news, article”].

Filter and hooks

Following filters and hooks can be used for customizing the email message.

<?php
// FILTERS
// Parameters: $value
add_filter( 'stc_message_length_sum_of_words', 'stc_message_length_sum_of_words', 10, 1 ); //set return value to a negative number to show the full content


// Parameters: $value, $post_id, $subscriber_post_id
add_filter( 'stc_message_title_html', 'my_stc_message_title_html', 10, 3 );
add_filter( 'stc_message_link_to_post_html', 'my_stc_message_link_to_post_html', 10, 3 );
add_filter( 'stc_message_unsubscribe_html', 'my_stc_message_unsubscribe_html', 10, 3 );

// HOOKS
// Parameters: $post_id, $subscriber_post_id  
add_action( 'stc_before_message', 'my_stc_before_message', 10, 2 );
add_action( 'stc_before_message_title', 'my_stc_before_message_title', 10, 2 );
add_action( 'stc_after_message_title', 'my_stc_after_message_title', 10, 2 );
add_action( 'stc_before_message_content', 'my_stc_before_message_content', 10, 2 );
add_action( 'stc_after_message_content', 'my_stc_after_message_content', 10, 2 );
add_action( 'stc_after_message', 'my_stc_after_message', 10, 2 );

// Parameters: $subscriber_post_id, $categories, bool $all_categories
add_action( 'stc_after_update_subscriber', 'my_stc_after_update_subscriber', 10, 3 );
add_action( 'stc_after_insert_subscriber', 'my_stc_after_insert_subscriber', 10, 3 );

// Parameters: $subscriber_post_id, 
add_action( 'stc_before_unsubscribe', 'my_stc_before_unsubscribe', 10, 1 ); // runs before deleting a subscriber from database


/**
 * Example for adding featured image to STC email
 */
function my_stc_after_message_title( $post_id ){
    echo get_the_post_thumbnail( $post_id, 'thumbnail' );
}
add_action( 'stc_after_message_title', 'my_stc_after_message_title', 10, 2 );

?>

Optionally but recommended

As WordPress Cron is depending on that you have visits on your website you should set up a cron job on your server to hit http://yourdomain.com/wp-cron.php at a regular interval to make sure that WP Cron is running as expected. In current version of Subscribe to Category the WP Cron is running once every hour, that might be an option that is changeable in future versions.
Therefore a suggested interval for your server cron could be once every 5 minutes.

Tinjauan

5 Juni 2020
This plugin does exactly what I need, it lets my users subscribe to a category and then receive an email every time a post is added to that category. Users can add themselves to multiple categories and catogories can be excluded from the opt in. Excellent
22 Februari 2020
How can do the same for custom post type.... this for normal posts... please answer
10 Februari 2017
Uses shortcodes to let your users subscribe to category posts. I like that the developer made it possible to exclude or include categories from the list. I have posts that are just for updating the slider and was able to exclude those from the subscription list. Thanks!
24 November 2016
I just tested the plugin, it seems that it is what I need, but I already encountered two problems. It says new subscriber, but I think that should have been new subscription. Really confusing. The second is that a user at subscriber level cannot see the plugin. I had to set it at least as contributor in order to make visible the plugin. After I figured out these, it was ok, the mail for the new post was queued fine, sent (manually) But still waiting for the mail to come. I have to figure where it got stuck. I hope to pass over this because I like the plugin.
3 September 2016
I've been looking for a plugin like this for ages, thank you so much for developing it. Super easy to use and configure, does exactly what I want and there was absolutely no hassle with setup. Thank you again for your excellent work on this.
Baca semua 15 tinjauan

Kontributor & Pengembang

“Subscribe to Category” adalah perangkat lunak sumber terbuka. Berikut ini mereka yang sudah berkontribusi pada plugin ini.

Para Kontributor

Log Perubahan

2.1.4

  • Changed tekst for using the Gutenberg/Block editor to be more clear
  • Redirect to first page after subscription stays now on the current page
  • Bug fixed causing not not to update the subscribers when using the classic WP editor

2.1.3

  • Added an admin feature to import a csv subscriberlist in exactly the same format as created by the export function

2.1.2

  • Added an admin setting to control the WP-Cron STC rescheduling “send email time”. Default is 3600 second but the user can now set it to any value between 180 and 3600 => 2 minutes and 1 hour

2.1.1

  • during sanitizing process the email adress from the unsubscriber lost the “@” sign causing failed unsubscribtion issues

2.1.0

  • implemented sanitizing and escaping according WPCS
  • adapted internationalization text domain to plugin standards
  • added ‘numberposts’ => -1 to the args for exporting all subscribers to excel it was defaulting to a maximum of 5
  • minor buxfixes

2.0.0

  • adapted stc to wp 5.3 features by adding a stc resend option to the document tab

1.9.0

  • Email address preset for logged in users.
  • Japanese, Dutch, German and Norwegian language added.

1.8.1

  • Added pot file to be used for translation.
  • Bugfix – changed textdomain to string instead of constant.

1.7.0

  • Added some new hooks: stc_after_update_subscriber, stc_after_insert_subscriber, stc_before_unsubscribe.

1.6.0

  • Added a Widget for subscription form.
  • Don’t show category list if only one is available (thanks to davefx).
  • Extended short code attributes with an option to use category id instead of category name (thanks to Stingray_454).

1.3

  • Added hooks and filters to make the plugin extensible.
  • Added Lithuanian language.

1.2.1

  • Fixed some undefined variables that might have caused some errors for some environments.
  • Renamed language files for russian language to correct syntax.
  • Added Italian language.

1.2.0

  • Possibillity to re-send a post on update that has already been sent. This option needs to be activated in the settings for the plugin.
  • Attribute ‘category_in’ added to shortcode to show only entered categories in the subscribe form. Multiple categories are separated by a comma sign.
  • Attribute ‘category_not_in’ added to shortcode to exclude categories in the subscribe form. Multiple categories are separated by a comma sign.

1.1.0

  • Added php sleep() function to prevent sending all e-mails in the same scope.
  • Using Ajax when send is manually triggered in back-end.

1.0.0

  • First release