Version Description
(23rd November, 2021) =
- Fix HTML widgets issue
- Fix logged-in user can see subscription form
Download this release
Release Info
Developer | tareq1988 |
Plugin | Subscribe2 |
Version | 10.37 |
Comparing to | |
See all releases |
Code changes from version 10.36 to 10.37
- admin/subscribers.php +2 -2
- changelog.txt +5 -0
- classes/class-s2-frontend.php +0 -52
- gutenberg/shortcode.js +1 -1
- gutenberg/shortcode.min.js +32 -1
- readme.txt +6 -1
- subscribe2.php +2 -2
- traits/ShortcodeTrait.php +56 -0
admin/subscribers.php
CHANGED
@@ -83,14 +83,14 @@ if ( isset( $_POST['s2_admin'] ) ) {
|
|
83 |
} elseif ( isset( $_POST['remind'] ) ) {
|
84 |
$this->remind( $_POST['reminderemails'] );
|
85 |
echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
|
86 |
-
} elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === $_POST['manage'] ) {
|
87 |
if ( isset( $_REQUEST['subscriber'] ) ) {
|
88 |
$this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
|
89 |
} else {
|
90 |
$this->subscribe_registered_users( $_POST['exportcsv'], $s2_request_category );
|
91 |
}
|
92 |
echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
|
93 |
-
} elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === $_POST['manage'] ) {
|
94 |
if ( isset( $_REQUEST['subscriber'] ) ) {
|
95 |
$this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
|
96 |
} else {
|
83 |
} elseif ( isset( $_POST['remind'] ) ) {
|
84 |
$this->remind( $_POST['reminderemails'] );
|
85 |
echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
|
86 |
+
} elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === (isset($_POST['manage']) ? $_POST['manage'] : '') ) {
|
87 |
if ( isset( $_REQUEST['subscriber'] ) ) {
|
88 |
$this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
|
89 |
} else {
|
90 |
$this->subscribe_registered_users( $_POST['exportcsv'], $s2_request_category );
|
91 |
}
|
92 |
echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
|
93 |
+
} elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === (isset($_POST['manage']) ? $_POST['manage'] : '') ) {
|
94 |
if ( isset( $_REQUEST['subscriber'] ) ) {
|
95 |
$this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
|
96 |
} else {
|
changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 10.36 (30th September, 2021) =
|
2 |
|
3 |
* WordPress 5.8 compatibility
|
1 |
+
= 10.37 (23rd November, 2021) =
|
2 |
+
|
3 |
+
* Fix HTML widgets issue
|
4 |
+
* Fix logged-in user can see subscription form
|
5 |
+
|
6 |
= 10.36 (30th September, 2021) =
|
7 |
|
8 |
* WordPress 5.8 compatibility
|
classes/class-s2-frontend.php
CHANGED
@@ -1,54 +1,5 @@
|
|
1 |
<?php
|
2 |
class S2_Frontend extends S2_Core {
|
3 |
-
/**
|
4 |
-
* Load all our strings
|
5 |
-
*/
|
6 |
-
public function load_strings() {
|
7 |
-
// Translators: Link to login page
|
8 |
-
$this->please_log_in = '<p class="s2_message">' . sprintf( __( 'To manage your subscription options please <a href="%1$s">login</a>.', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' ) . '</p>';
|
9 |
-
|
10 |
-
$profile = apply_filters( 's2_profile_link', get_option( 'siteurl' ) . '/wp-admin/admin.php?page=s2' );
|
11 |
-
// Translators: Link to Profile page
|
12 |
-
$this->profile = '<p class="s2_message">' . sprintf( __( 'You may manage your subscription options from your <a href="%1$s">profile</a>.', 'subscribe2' ), $profile ) . '</p>';
|
13 |
-
if ( true === $this->s2_mu ) {
|
14 |
-
global $blog_id;
|
15 |
-
$user_ID = get_current_user_id();
|
16 |
-
if ( ! is_user_member_of_blog( $user_ID, $blog_id ) ) {
|
17 |
-
// if we are on multisite and the user is not a member of this blog change the link
|
18 |
-
$mu_profile = apply_filters( 's2_mu_profile_link', get_option( 'siteurl' ) . '/wp-admin/?s2mu_subscribe=' . $blog_id );
|
19 |
-
// Translators: Link to Profile page
|
20 |
-
$this->profile = '<p class="s2_message">' . sprintf( __( '<a href="%1$s">Subscribe</a> to email notifications when this blog posts new content.', 'subscribe2' ), $mu_profile ) . '</p>';
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
$this->confirmation_sent = '<p class="s2_message">' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
|
25 |
-
|
26 |
-
$this->already_subscribed = '<p class="s2_error">' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
|
27 |
-
|
28 |
-
$this->not_subscribed = '<p class="s2_error">' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
|
29 |
-
|
30 |
-
$this->not_an_email = '<p class="s2_error">' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
|
31 |
-
|
32 |
-
$this->barred_domain = '<p class="s2_error">' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
|
33 |
-
|
34 |
-
$this->error = '<p class="s2_error">' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
|
35 |
-
|
36 |
-
// confirmation messages
|
37 |
-
$this->no_such_email = '<p class="s2_error">' . __( 'No such email address is registered.', 'subscribe2' ) . '</p>';
|
38 |
-
|
39 |
-
$this->added = '<p class="s2_message">' . __( 'You have successfully subscribed!', 'subscribe2' ) . '</p>';
|
40 |
-
|
41 |
-
$this->deleted = '<p class="s2_message">' . __( 'You have successfully unsubscribed.', 'subscribe2' ) . '</p>';
|
42 |
-
|
43 |
-
$this->subscribe = __( 'subscribe', 'subscribe2' ); //ACTION replacement in subscribing confirmation email
|
44 |
-
|
45 |
-
$this->unsubscribe = __( 'unsubscribe', 'subscribe2' ); //ACTION replacement in unsubscribing in confirmation email
|
46 |
-
|
47 |
-
if ( isset( $_GET['s2_unsub'] ) && ! empty( $_GET['s2_unsub'] ) ) {
|
48 |
-
$this->unsubscribe( $_GET['s2_unsub'] );
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
/**
|
53 |
* Process unsubscribe
|
54 |
*
|
@@ -343,9 +294,6 @@ class S2_Frontend extends S2_Core {
|
|
343 |
return $tag;
|
344 |
}
|
345 |
|
346 |
-
/* ===== define some variables ===== */
|
347 |
-
public $profile = '';
|
348 |
-
|
349 |
|
350 |
/**
|
351 |
* Create and display a dropdown list of pages
|
1 |
<?php
|
2 |
class S2_Frontend extends S2_Core {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
* Process unsubscribe
|
5 |
*
|
294 |
return $tag;
|
295 |
}
|
296 |
|
|
|
|
|
|
|
297 |
|
298 |
/**
|
299 |
* Create and display a dropdown list of pages
|
gutenberg/shortcode.js
CHANGED
@@ -388,7 +388,7 @@
|
|
388 |
];
|
389 |
},
|
390 |
save: function( props ) {
|
391 |
-
return el( element.RawHTML, null, '<p>' + props
|
392 |
}
|
393 |
}
|
394 |
);
|
388 |
];
|
389 |
},
|
390 |
save: function( props ) {
|
391 |
+
return el( element.RawHTML, null, '<p>' + s2shortcode(props) + '</p>' );
|
392 |
}
|
393 |
}
|
394 |
);
|
gutenberg/shortcode.min.js
CHANGED
@@ -1 +1,32 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(blocks,i18n,element,components,editor){var el=element.createElement,TextControl=components.TextControl,CheckboxControl=components.CheckboxControl,RadioControl=components.RadioControl;function s2shortcode(props,control,newVal){var attributes=props.attributes||'';var hide='',id='',nojs='',antispam='',size='',wrap='',link='';if('subscribe'===attributes.hide){hide=' hide="subscribe"'}else if('unsubscribe'===attributes.hide){hide=' hide="unsubscribe"'}
|
2 |
+
if(''!==attributes.id&&undefined!==attributes.id){id=' id="'+attributes.id+'"'}
|
3 |
+
if(!0===attributes.nojs){nojs=' nojs="true"'}
|
4 |
+
if(!0===attributes.antispam){antispam=' antispam="true"'}
|
5 |
+
if(''!==attributes.size&&undefined!==attributes.size&&'20'!==attributes.size){size=' size="'+attributes.size+'"'}
|
6 |
+
if(!0===attributes.wrap){wrap=' wrap="false"'}
|
7 |
+
if(''!==attributes.link&&undefined!==attributes.link){link=' link="'+attributes.link+'"'}
|
8 |
+
switch(control){case 'hide':if('none'===newVal){hide=''}else if('subscribe'===newVal){hide=' hide="subscribe"'}else if('unsubscribe'===newVal){hide=' hide="unsubscribe"'}
|
9 |
+
break;case 'id':if(''===newVal){id=''}else{id=' id="'+newVal+'"'}
|
10 |
+
break;case 'nojs':if(!0===newVal){nojs=' nojs="true"'}else if(!1===newVal){nojs=''}
|
11 |
+
break;case 'antispam':if(!0===newVal){antispam=' antispam="true"'}else if(!1===newVal){antispam=''}
|
12 |
+
break;case 'size':if('20'===newVal){size=''}else{size=' size="'+newVal+'"'}
|
13 |
+
break;case 'wrap':if(!0===newVal){wrap=' wrap="false"'}else if(!1===newVal){wrap=''}
|
14 |
+
break;case 'link':if(''===newVal){link=''}else{link=' link="'+newVal+'"'}
|
15 |
+
break;default:break}
|
16 |
+
props.attributes.shortcode='[subscribe2'+hide+id+nojs+antispam+size+wrap+link+']';return props.attributes.shortcode}
|
17 |
+
blocks.registerBlockType('subscribe2-html/shortcode',{title:i18n.__('Subscribe2 HTML','subscribe2'),icon:'email',category:'widgets',keywords:[i18n.__('email','subscribe2'),i18n.__('notification','subscribe2')],supports:{customClassName:!1,className:!1,multiple:!1,html:!1},attributes:{shortcode:{type:'text',selector:'p'},hide:{type:'string'},id:{type:'string'},nojs:{type:'boolean'},antispam:{type:'boolean'},size:{type:'number'},wrap:{type:'boolean'},link:{type:'string'}},transforms:{to:[{type:'block',blocks:['core/shortcode'],transform:function(content){if(undefined===content.shortcode||''===content.shortcode){content.shortcode='[subscribe2]'}
|
18 |
+
return blocks.createBlock('core/shortcode',{text:content.shortcode})}}],from:[{type:'block',blocks:['core/shortcode'],transform:function(content){var shortcode,params,param,hide,id,nojs,antispam,size,wrap,link,i,l;if('subscribe2'===content.text.substr(1,10)){shortcode=content.text;params=content.text.replace(/^\[subscribe2|\]$/g,'').replace(/^\s+|\s+$/g,'').split(/['"]\s/g);l=params.length;for(i=0;i<l;i++){param=params[i].split('=');if('hide'===param[0]){hide=param[1].replace(/['"]+/g,'')}
|
19 |
+
if('id'===param[0]){id=param[1].replace(/['"]+/g,'')}
|
20 |
+
if('nojs'===param[0]){nojs='true'===param[1].replace(/['"]+/g,'')}
|
21 |
+
if('antispam'===param[0]){antispam='true'===param[1].replace(/['"]+/g,'')}
|
22 |
+
if('size'===param[0]){size=param[1].replace(/['"]+/g,'')}
|
23 |
+
if('wrap'===param[0]){wrap='false'===param[1].replace(/['"]+/g,'')}
|
24 |
+
if('link'===param[0]){link=param[1].replace(/^['"]|['"]$/g,'')}}
|
25 |
+
return blocks.createBlock('subscribe2-html/shortcode',{shortcode:shortcode,hide:hide,id:id,nojs:nojs,antispam:antispam,size:size,wrap:wrap,link:link})}}},{type:'shortcode',tag:'subscribe2',attributes:{shortcode:{type:'string',selector:'p'},hide:{type:'string',shortcode:function(content){return content.named.hide||'none'}},id:{type:'string',shortcode:function(content){return content.named.id||''}},nojs:{type:'boolean',shortcode:function(content){return content.named.nojs||!1}},antispam:{type:'boolean',shortcode:function(content){return content.named.antispam||!1}},size:{type:'number',shortcode:function(content){return content.named.size||'20'}},wrap:{type:'boolean',shortcode:function(content){return content.named.wrap||!1}},link:{type:'string',shortcode:function(content){return content.named.link||''}}}}]},edit:function(props){var hide=props.attributes.hide||'none',id=props.attributes.id||'',nojs=props.attributes.nojs||!1,antispam=props.attributes.antispam||!1,size=props.attributes.size||'20',wrap=props.attributes.wrap||!1,link=props.attributes.link||'',isSelected=props.isSelected;function onChangeHide(newHide){props.attributes.shortcode=s2shortcode(props,'hide',newHide);props.setAttributes({hide:newHide})}
|
26 |
+
function onChangeId(newId){props.attributes.shortcode=s2shortcode(props,'id',newId);props.setAttributes({id:newId})}
|
27 |
+
function onChangeNojs(newNojs){props.attributes.shortcode=s2shortcode(props,'nojs',newNojs);props.setAttributes({nojs:newNojs})}
|
28 |
+
function onChangeAntispam(newAntispam){props.attributes.shortcode=s2shortcode(props,'antispam',newAntispam);props.setAttributes({antispam:newAntispam})}
|
29 |
+
function onChangeSize(newSize){props.attributes.shortcode=s2shortcode(props,'size',newSize);props.setAttributes({size:newSize})}
|
30 |
+
function onChangeWrap(newWrap){props.attributes.shortcode=s2shortcode(props,'wrap',newWrap);props.setAttributes({wrap:newWrap})}
|
31 |
+
function onChangeLink(newLink){props.attributes.shortcode=s2shortcode(props,'link',newLink);props.setAttributes({link:newLink})}
|
32 |
+
return[isSelected&&el(editor.InspectorControls,{key:'subscribe2-html/inspector'},el('h3',{},i18n.__('Subscribe2 Shortcode Parameters','subscribe2')),el(RadioControl,{label:i18n.__('Button Display Options','subscribe2'),selected:hide,onChange:onChangeHide,options:[{value:'none',label:i18n.__('Show Both Buttons','subscribe2')},{value:'subscribe',label:i18n.__('Hide Subscribe Button','subscribe2')},{value:'unsubscribe',label:i18n.__('Hide Unsubscribe Button','subscribe2')}]}),el(TextControl,{type:'number',label:i18n.__('Page ID','subscribe2'),value:id,onChange:onChangeId}),el(CheckboxControl,{label:i18n.__('Disable Javascript','subscribe2'),checked:nojs,onChange:onChangeNojs}),el(CheckboxControl,{label:i18n.__('Disable Simple Anti-Spam Measures','subscribe2'),checked:antispam,onChange:onChangeAntispam}),el(TextControl,{type:'number',label:i18n.__('Textbox size','subscribe2'),value:size,onChange:onChangeSize}),el(CheckboxControl,{label:i18n.__('Disable wrapping of form buttons','subscribe2'),checked:wrap,onChange:onChangeWrap}),el(TextControl,{type:'string',label:i18n.__('Link Text','subscribe2'),value:link,onChange:onChangeLink})),el('div',{key:'subscribe2-html/block',style:{backgroundColor:'#ff0',color:'#000',padding:'2px','textAlign':'center'}},i18n.__('Subscribe2 HTML Shortcode','subscribe2'))]},save:function(props){return el(element.RawHTML,null,'<p>'+s2shortcode(props)+'</p>')}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.editor))
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://getwemail.io
|
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 10.
|
8 |
Requires PHP: 5.4
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
@@ -72,6 +72,11 @@ This token will automatically be replaced by dynamic subscription information an
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
= 10.36 (30th September, 2021) =
|
76 |
|
77 |
* WordPress 5.8 compatibility
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 10.37
|
8 |
Requires PHP: 5.4
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 10.37 (23rd November, 2021) =
|
76 |
+
|
77 |
+
* Fix HTML widgets issue
|
78 |
+
* Fix logged-in user can see subscription form
|
79 |
+
|
80 |
= 10.36 (30th September, 2021) =
|
81 |
|
82 |
* WordPress 5.8 compatibility
|
subscribe2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: https://getwemail.io
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
-
Version: 10.
|
7 |
Author: weMail
|
8 |
Author URI: https://getwemail.io
|
9 |
Licence: GPLv3
|
@@ -54,7 +54,7 @@ if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
|
|
54 |
|
55 |
// our version number. Don't touch this or any line below
|
56 |
// unless you know exactly what you are doing
|
57 |
-
define( 'S2VERSION', '10.
|
58 |
define( 'S2PLUGIN', __FILE__ );
|
59 |
define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
|
60 |
define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: https://getwemail.io
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
+
Version: 10.37
|
7 |
Author: weMail
|
8 |
Author URI: https://getwemail.io
|
9 |
Licence: GPLv3
|
54 |
|
55 |
// our version number. Don't touch this or any line below
|
56 |
// unless you know exactly what you are doing
|
57 |
+
define( 'S2VERSION', '10.37' );
|
58 |
define( 'S2PLUGIN', __FILE__ );
|
59 |
define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
|
60 |
define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
|
traits/ShortcodeTrait.php
CHANGED
@@ -1,6 +1,58 @@
|
|
1 |
<?php
|
2 |
|
3 |
trait Shortcode {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
/* ===== template and filter functions ===== */
|
5 |
/**
|
6 |
* Display our form; also handles (un)subscribe requests
|
@@ -114,6 +166,10 @@ trait Shortcode {
|
|
114 |
}
|
115 |
$this->s2form = apply_filters( 's2_form', $this->form, $args );
|
116 |
|
|
|
|
|
|
|
|
|
117 |
if ( isset( $_POST['subscribe'] ) || isset( $_POST['unsubscribe'] ) ) {
|
118 |
// anti spam sign up measure
|
119 |
if ( ( isset( $_POST['firstname'] ) && '' !== $_POST['firstname'] ) || ( isset( $_POST['lastname'] ) && '' !== $_POST['lastname'] ) || ( isset( $_POST['uri'] ) && 'http://' !== $_POST['uri'] ) ) {
|
1 |
<?php
|
2 |
|
3 |
trait Shortcode {
|
4 |
+
/* ===== define some variables ===== */
|
5 |
+
public $profile = '';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Load all our strings
|
9 |
+
*/
|
10 |
+
public function load_strings() {
|
11 |
+
// Translators: Link to login page
|
12 |
+
$this->please_log_in = '<p class="s2_message">' . sprintf( __( 'To manage your subscription options please <a href="%1$s">login</a>.', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' ) . '</p>';
|
13 |
+
|
14 |
+
$profile = apply_filters( 's2_profile_link', get_option( 'siteurl' ) . '/wp-admin/admin.php?page=s2' );
|
15 |
+
// Translators: Link to Profile page
|
16 |
+
$this->profile = '<p class="s2_message">' . sprintf( __( 'You may manage your subscription options from your <a href="%1$s">profile</a>.', 'subscribe2' ), $profile ) . '</p>';
|
17 |
+
if ( true === $this->s2_mu ) {
|
18 |
+
global $blog_id;
|
19 |
+
$user_ID = get_current_user_id();
|
20 |
+
if ( ! is_user_member_of_blog( $user_ID, $blog_id ) ) {
|
21 |
+
// if we are on multisite and the user is not a member of this blog change the link
|
22 |
+
$mu_profile = apply_filters( 's2_mu_profile_link', get_option( 'siteurl' ) . '/wp-admin/?s2mu_subscribe=' . $blog_id );
|
23 |
+
// Translators: Link to Profile page
|
24 |
+
$this->profile = '<p class="s2_message">' . sprintf( __( '<a href="%1$s">Subscribe</a> to email notifications when this blog posts new content.', 'subscribe2' ), $mu_profile ) . '</p>';
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
$this->confirmation_sent = '<p class="s2_message">' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
|
29 |
+
|
30 |
+
$this->already_subscribed = '<p class="s2_error">' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
|
31 |
+
|
32 |
+
$this->not_subscribed = '<p class="s2_error">' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
|
33 |
+
|
34 |
+
$this->not_an_email = '<p class="s2_error">' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
|
35 |
+
|
36 |
+
$this->barred_domain = '<p class="s2_error">' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
|
37 |
+
|
38 |
+
$this->error = '<p class="s2_error">' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
|
39 |
+
|
40 |
+
// confirmation messages
|
41 |
+
$this->no_such_email = '<p class="s2_error">' . __( 'No such email address is registered.', 'subscribe2' ) . '</p>';
|
42 |
+
|
43 |
+
$this->added = '<p class="s2_message">' . __( 'You have successfully subscribed!', 'subscribe2' ) . '</p>';
|
44 |
+
|
45 |
+
$this->deleted = '<p class="s2_message">' . __( 'You have successfully unsubscribed.', 'subscribe2' ) . '</p>';
|
46 |
+
|
47 |
+
$this->subscribe = __( 'subscribe', 'subscribe2' ); //ACTION replacement in subscribing confirmation email
|
48 |
+
|
49 |
+
$this->unsubscribe = __( 'unsubscribe', 'subscribe2' ); //ACTION replacement in unsubscribing in confirmation email
|
50 |
+
|
51 |
+
if ( isset( $_GET['s2_unsub'] ) && ! empty( $_GET['s2_unsub'] ) ) {
|
52 |
+
$this->unsubscribe( $_GET['s2_unsub'] );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
/* ===== template and filter functions ===== */
|
57 |
/**
|
58 |
* Display our form; also handles (un)subscribe requests
|
166 |
}
|
167 |
$this->s2form = apply_filters( 's2_form', $this->form, $args );
|
168 |
|
169 |
+
if ( is_user_logged_in() ) {
|
170 |
+
return $this->profile;
|
171 |
+
}
|
172 |
+
|
173 |
if ( isset( $_POST['subscribe'] ) || isset( $_POST['unsubscribe'] ) ) {
|
174 |
// anti spam sign up measure
|
175 |
if ( ( isset( $_POST['firstname'] ) && '' !== $_POST['firstname'] ) || ( isset( $_POST['lastname'] ) && '' !== $_POST['lastname'] ) || ( isset( $_POST['uri'] ) && 'http://' !== $_POST['uri'] ) ) {
|