Version Description
Download this release
Release Info
| Developer | wpkube |
| Plugin | |
| Version | 200205 |
| Comparing to | |
| See all releases | |
Code changes from version 200204 to 200205
- readme.txt +2 -2
- subscribe-to-comments-reloaded.php +1 -1
- utils/functions.php +107 -0
- wp_subscribe_reloaded.php +1 -1
readme.txt
CHANGED
|
@@ -7,7 +7,7 @@ Requires at least: 4.0
|
|
| 7 |
Requires PHP: 5.6
|
| 8 |
Requires MySQL: 5.6
|
| 9 |
Tested up to: 5.3
|
| 10 |
-
Stable tag:
|
| 11 |
License: GPLv2 or later
|
| 12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 13 |
|
|
@@ -99,7 +99,7 @@ Just go to the Options Panel and click the generate button. By generating a new
|
|
| 99 |
7. Manage the subscriptions on the Frontend Side.
|
| 100 |
|
| 101 |
== Changelog ==
|
| 102 |
-
=
|
| 103 |
* **New** Function for developers to add subscribers. [Check the guide](https://subscribe-reloaded.com/function-to-add-subscribers-manually/)
|
| 104 |
* **New** Option to set a challenge (question + answer) for the "subscribe without commenting" form to prevent automatic bot submissions
|
| 105 |
* **Fix** It is now possible to send out plain text emails instead of HTML emails. [Check the guide](https://subscribe-reloaded.com/send-plain-text-emails-instead-of-html-emails/)
|
| 7 |
Requires PHP: 5.6
|
| 8 |
Requires MySQL: 5.6
|
| 9 |
Tested up to: 5.3
|
| 10 |
+
Stable tag: 200205
|
| 11 |
License: GPLv2 or later
|
| 12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 13 |
|
| 99 |
7. Manage the subscriptions on the Frontend Side.
|
| 100 |
|
| 101 |
== Changelog ==
|
| 102 |
+
= v200205 =
|
| 103 |
* **New** Function for developers to add subscribers. [Check the guide](https://subscribe-reloaded.com/function-to-add-subscribers-manually/)
|
| 104 |
* **New** Option to set a challenge (question + answer) for the "subscribe without commenting" form to prevent automatic bot submissions
|
| 105 |
* **Fix** It is now possible to send out plain text emails instead of HTML emails. [Check the guide](https://subscribe-reloaded.com/send-plain-text-emails-instead-of-html-emails/)
|
subscribe-to-comments-reloaded.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
/**
|
| 3 |
* Plugin Name: Subscribe to Comments Reloaded
|
| 4 |
* Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
|
| 5 |
-
* Version:
|
| 6 |
* Author: WPKube
|
| 7 |
* Author URI: http://wpkube.com/
|
| 8 |
* License: GPL-2.0+
|
| 2 |
/**
|
| 3 |
* Plugin Name: Subscribe to Comments Reloaded
|
| 4 |
* Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
|
| 5 |
+
* Version: 200205
|
| 6 |
* Author: WPKube
|
| 7 |
* Author URI: http://wpkube.com/
|
| 8 |
* License: GPL-2.0+
|
utils/functions.php
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
if ( ! function_exists( 'stcr_add_subscriber' ) ) {
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Add subscriber
|
| 6 |
+
*
|
| 7 |
+
* @since 200205
|
| 8 |
+
*/
|
| 9 |
+
function stcr_add_subscription( $data ) {
|
| 10 |
+
|
| 11 |
+
// no data supplied, return
|
| 12 |
+
if ( ! is_array( $data ) ) return;
|
| 13 |
+
|
| 14 |
+
// no post ID supplied, return
|
| 15 |
+
if ( empty( $data['post_id'] ) ) return;
|
| 16 |
+
|
| 17 |
+
// no email supplied, return
|
| 18 |
+
if ( empty( $data['email'] ) ) return;
|
| 19 |
+
|
| 20 |
+
// default type
|
| 21 |
+
if ( empty( $data['type'] ) ) $data['type'] = 'all';
|
| 22 |
+
|
| 23 |
+
// get status code
|
| 24 |
+
switch ( $data['type'] ) {
|
| 25 |
+
|
| 26 |
+
case 'all':
|
| 27 |
+
$status = 'Y';
|
| 28 |
+
break;
|
| 29 |
+
|
| 30 |
+
case 'all_unconfirmed':
|
| 31 |
+
$status = 'YC';
|
| 32 |
+
break;
|
| 33 |
+
|
| 34 |
+
case 'replies':
|
| 35 |
+
$status = 'R';
|
| 36 |
+
break;
|
| 37 |
+
|
| 38 |
+
case 'replies_unconfirmed':
|
| 39 |
+
$status = 'RC';
|
| 40 |
+
break;
|
| 41 |
+
|
| 42 |
+
case 'inactive':
|
| 43 |
+
$status = 'C';
|
| 44 |
+
break;
|
| 45 |
+
|
| 46 |
+
case 'active':
|
| 47 |
+
$status = '-C';
|
| 48 |
+
break;
|
| 49 |
+
|
| 50 |
+
default:
|
| 51 |
+
$status = 'Y';
|
| 52 |
+
break;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// notify admin?
|
| 56 |
+
$notify_admin = false;
|
| 57 |
+
if ( get_option( 'subscribe_reloaded_enable_admin_messages' ) == 'yes' ) $notify_admin = true;
|
| 58 |
+
if ( isset( $data['notify_admin'] ) && $data['notify_admin'] == true ) $notify_admin = true;
|
| 59 |
+
if ( isset( $data['notify_admin'] ) && $data['notify_admin'] == false ) $notify_admin = false;
|
| 60 |
+
|
| 61 |
+
// notify subscriber?
|
| 62 |
+
$notify_subscriber = false;
|
| 63 |
+
if ( get_option( 'subscribe_reloaded_enable_double_check' ) == 'yes' ) $notify_subscriber = true;
|
| 64 |
+
if ( in_array( $status, array( 'Y', 'R' ) ) ) {
|
| 65 |
+
// no need for confirmation email beacuse it's a confirmed subscription
|
| 66 |
+
$notify_subscriber = false;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// get the class instance
|
| 70 |
+
global $wp_subscribe_reloaded;
|
| 71 |
+
|
| 72 |
+
// sanitize email address
|
| 73 |
+
$clean_email = $wp_subscribe_reloaded->stcr->utils->clean_email( $data['email'] );
|
| 74 |
+
|
| 75 |
+
// notify the administrator about the new subscription
|
| 76 |
+
if ( $notify_admin ) {
|
| 77 |
+
|
| 78 |
+
$from_name = stripslashes( get_option( 'subscribe_reloaded_from_name', 'admin' ) );
|
| 79 |
+
$from_email = get_option( 'subscribe_reloaded_from_email', get_bloginfo( 'admin_email' ) );
|
| 80 |
+
|
| 81 |
+
$subject = __( 'New subscription to', 'subscribe-to-comments-reloaded' ) . ' ' . get_the_title( $data['post_id'] );
|
| 82 |
+
$message = __( 'New subscription to', 'subscribe-to-comments-reloaded' ) . ' ' . get_the_title( $data['post_id'] ) . PHP_EOL . __( 'User:', 'subscribe-to-comments-reloaded' ) . " $clean_email";
|
| 83 |
+
|
| 84 |
+
$email_settings = array(
|
| 85 |
+
'subject' => $subject,
|
| 86 |
+
'message' => $message,
|
| 87 |
+
'toEmail' => get_bloginfo( 'admin_email' )
|
| 88 |
+
);
|
| 89 |
+
|
| 90 |
+
$wp_subscribe_reloaded->stcr->utils->send_email( $email_settings );
|
| 91 |
+
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// double check, send confirmation email
|
| 95 |
+
if ( $notify_subscriber && ! $wp_subscribe_reloaded->stcr->is_user_subscribed( $data['post_id'], $clean_email, 'C' ) ) {
|
| 96 |
+
|
| 97 |
+
$wp_subscribe_reloaded->stcr->add_subscription( $data['post_id'], $clean_email, $status );
|
| 98 |
+
$wp_subscribe_reloaded->stcr->confirmation_email( $data['post_id'], $clean_email );
|
| 99 |
+
|
| 100 |
+
// not double check, add subscription
|
| 101 |
+
} else {
|
| 102 |
+
$wp_subscribe_reloaded->stcr->add_subscription( $data['post_id'], $clean_email, $status );
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
}
|
wp_subscribe_reloaded.php
CHANGED
|
@@ -8,7 +8,7 @@ if ( ! function_exists( 'add_action' ) ) {
|
|
| 8 |
}
|
| 9 |
|
| 10 |
// globals
|
| 11 |
-
define( __NAMESPACE__.'\\VERSION','
|
| 12 |
define( __NAMESPACE__.'\\DEVELOPMENT', false );
|
| 13 |
define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
|
| 14 |
|
| 8 |
}
|
| 9 |
|
| 10 |
// globals
|
| 11 |
+
define( __NAMESPACE__.'\\VERSION','200205' );
|
| 12 |
define( __NAMESPACE__.'\\DEVELOPMENT', false );
|
| 13 |
define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
|
| 14 |
|
