Changeset 1449435
- Timestamp:
- 07/05/2016 06:08:44 PM (10 years ago)
- Location:
- auto-subscribe-users/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (2 diffs)
-
auto-subscribe-users.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-subscribe-users/trunk/README.txt
r1445482 r1449435 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.5.3 7 Stable tag: 0.0. 57 Stable tag: 0.0.6 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 74 74 == Changelog == 75 75 76 = 0.0.6 = 77 * If user manually auto subscribes, won't be auto subscribed when that user creates new site in multisite. 78 76 79 = 0.0.5 = 77 80 * Updated readme. -
auto-subscribe-users/trunk/auto-subscribe-users.php
r1442774 r1449435 6 6 Author: Harshit Sanghvi 7 7 Author URI: https://sanghviharshit.com 8 Version: 0.0. 58 Version: 0.0.6 9 9 License: GNU General Public License (Version 3 - GPLv3) 10 10 */ … … 38 38 class Auto_Subscribe_Users { 39 39 40 41 private $sbe_key; 42 private $esn_key; 43 40 44 /** 41 45 * Constructor. 42 46 */ 43 47 function __construct() { 48 $this->sbe_key = 'asu_sbe'; 49 $this->esn_key = 'asu_esn'; 50 44 51 add_action( 'init', array( $this, 'init' ), 1 ); 45 52 } … … 139 146 } 140 147 141 if( function_exists( 'es_sync_registereduser') ) { 142 // If Email Subscribers & Newsletter Plugin is active on the main site 143 $es_c_emailsubscribers = get_option('es_c_emailsubscribers', 'norecord'); 144 self::write_log("es_c_emailsubscribers" . $es_c_emailsubscribers); 148 $user_esn = get_user_meta($user_id, $this->esn_key, $single = true); 149 150 // Check if Email Subscribers & Newsletter Plugin is active on the main site 151 if( $user_esn != '' && $user_esn != 'true' ) { 152 if( function_exists( 'es_sync_registereduser') ) { 153 154 $es_c_emailsubscribers = get_option('es_c_emailsubscribers', 'norecord'); 155 //self::write_log("es_c_emailsubscribers" . $es_c_emailsubscribers); 145 156 if($es_c_emailsubscribers == 'norecord' || $es_c_emailsubscribers == "" || (!empty($es_c_emailsubscribers['es_registered']) && $es_c_emailsubscribers['es_registered'] <> "YES")) { 146 157 $es_c_emailsubscribers_bak = $es_c_emailsubscribers; … … 151 162 es_sync_registereduser($user_id); 152 163 update_option('es_c_emailsubscribers', $$es_c_emailsubscribers_bak); 153 }154 164 155 } else if ( class_exists( 'Incsub_Subscribe_By_Email' ) && method_exists( 'Incsub_Subscribe_By_Email', 'subscribe_user' ) && method_exists( 'Incsub_Subscribe_By_Email', 'send_confirmation_mail' ) ) { 156 // The Subscription plugin has to be active on the main site. If WPMYU's Subscribe by Email plugin is not active, there's nothing to do. 157 $user_info = get_userdata($user_id); 158 //Force email confirmation 159 $subscription_id = Incsub_Subscribe_By_Email::subscribe_user( $user_info->user_email, __( 'Auto Subscribe', INCSUB_SBE_LANG_DOMAIN ), __( 'Auto Subscribed on Create Site Action', INCSUB_SBE_LANG_DOMAIN ), true ); 160 //Incsub_Subscribe_By_Email::send_confirmation_mail( $subscription_id, $force = true ); 161 } 165 //Add auto subscribed boolean to user meta, so if the user unsubscribes, we don't auto subscribe that user next time the user registers new site. 166 update_user_meta( $user_id, $this->esn_key, 'true' ); 167 } 168 } 169 } 170 171 $user_sbe = get_user_meta($user_id, $this->sbe_key, $single = true); 172 173 if( $user_sbe != '' && $user_sbe != 'true' ) { 174 // Check if WPMU Subscribe By Email plugin is active 175 if ( class_exists( 'Incsub_Subscribe_By_Email' ) && method_exists( 'Incsub_Subscribe_By_Email', 'subscribe_user' ) && method_exists( 'Incsub_Subscribe_By_Email', 'send_confirmation_mail' ) ) { 176 // The Subscription plugin has to be active on the main site. If WPMYU's Subscribe by Email plugin is not active, there's nothing to do. 177 $user_info = get_userdata($user_id); 178 //Force email confirmation 179 $subscription_id = Incsub_Subscribe_By_Email::subscribe_user( $user_info->user_email, __( 'Auto Subscribe', INCSUB_SBE_LANG_DOMAIN ), __( 'Auto Subscribed on Create Site Action', INCSUB_SBE_LANG_DOMAIN ), true ); 180 //ToDo: settings page 181 //Incsub_Subscribe_By_Email::send_confirmation_mail( $subscription_id, $force = true ); 182 183 //Add auto subscribed boolean to user meta, so if the user unsubsribes, we don't auto subscribe that user next time the user registers new site. 184 update_user_meta( $user_id, $this->sbe_key, 'true' ); 185 } 186 } 162 187 163 188 }
Note: See TracChangeset
for help on using the changeset viewer.