Changeset 2585159
- Timestamp:
- 08/19/2021 04:04:16 AM (3 years ago)
- Location:
- affiliatewp-force-pending-referrals
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
affiliatewp-force-pending-referrals/tags/1.1.1/affiliatewp-force-pending-referrals.php
r2553492 r2585159 6 6 * Author: Sandhills Development, LLC 7 7 * Author URI: https://sandhillsdev.com 8 * Version: 1.1 8 * Version: 1.1 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.opensource.org/licenses/gpl-license.php -
affiliatewp-force-pending-referrals/tags/1.1.1/includes/class-affiliatewp-force-pending-referrals.php
r2553492 r2585159 42 42 * @var string 43 43 */ 44 private $version = '1.1 ';44 private $version = '1.1'; 45 45 46 46 /** … … 202 202 add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), null, 2 ); 203 203 204 // disable auto complete referrals. 205 add_filter( 'affwp_auto_complete_referral', '__return_false' ); 206 204 $affwp_version = get_option( 'affwp_version' ); 205 206 if ( version_compare( $affwp_version, '2.7.1', '<' ) ) { 207 // disable auto complete referrals. 208 add_filter( 'affwp_auto_complete_referral', '__return_false' ); 209 } else { 210 add_filter( 'affwp_auto_complete_referral', array( $this, 'maybe_disallow_complete_referral' ), 10, 2 ); 211 } 212 213 } 214 215 /** 216 * (Maybe) disallows a referral from being completed via complete_referral() in the Integrations API. 217 * 218 * @since 1.1.1 219 * 220 * @param bool $allow Whether to allow the referral to be completed. 221 * @param \AffWP\Referral $referral Referral object. 222 * @return bool True if the referral should continue to be processed as if Force Pending Referrals 223 * was not present, otherwise false. 224 */ 225 public function maybe_disallow_complete_referral( $allow, $referral ) { 226 if ( 'rejected' === $referral->status ) { 227 $set = affwp_set_referral_status( $referral, 'pending' ); 228 229 if ( true === $set ) { 230 affiliate_wp()->utils->log( 'Force Pending Referrals: Rejected referral successfully set to Pending.' ); 231 } else { 232 affiliate_wp()->utils->log( 'Force Pending Referrals: Rejected referral could not successfully be set to Pending.' ); 233 } 234 235 $allow = false; 236 237 } elseif ( 'pending' === $referral->status ) { 238 $allow = false; 239 } 240 241 return $allow; 207 242 } 208 243 -
affiliatewp-force-pending-referrals/tags/1.1.1/readme.txt
r2553559 r2585159 3 3 Tags: AffiliateWP, affiliate, Pippin Williamson, Andrew Munro, mordauk, pippinsplugins, sumobi, ecommerce, e-commerce, e commerce, selling, membership 4 4 Requires at least: 5.0 5 Tested up to: 5. 75 Tested up to: 5. 6 6 Requires PHP: 5.6 7 Stable tag: 1.1 7 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 > This plugin requires [AffiliateWP](https://affiliatewp.com/ "AffiliateWP") 2.6+.<strong>It will NOT function without it.</strong>15 > This plugin requires [AffiliateWP](https://affiliatewp.com/ "AffiliateWP")<strong>It will NOT function without it.</strong> 16 16 17 17 Once activated, all referrals created by AffiliateWP will be forced to a status of "pending". … … 39 39 == Changelog == 40 40 41 42 43 41 44 = 1.1 = 42 45 * New: Enforce minimum dependency requirements checking -
affiliatewp-force-pending-referrals/trunk/affiliatewp-force-pending-referrals.php
r2553492 r2585159 6 6 * Author: Sandhills Development, LLC 7 7 * Author URI: https://sandhillsdev.com 8 * Version: 1.1 8 * Version: 1.1 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.opensource.org/licenses/gpl-license.php -
affiliatewp-force-pending-referrals/trunk/includes/class-affiliatewp-force-pending-referrals.php
r2553492 r2585159 42 42 * @var string 43 43 */ 44 private $version = '1.1 ';44 private $version = '1.1'; 45 45 46 46 /** … … 202 202 add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), null, 2 ); 203 203 204 // disable auto complete referrals. 205 add_filter( 'affwp_auto_complete_referral', '__return_false' ); 206 204 $affwp_version = get_option( 'affwp_version' ); 205 206 if ( version_compare( $affwp_version, '2.7.1', '<' ) ) { 207 // disable auto complete referrals. 208 add_filter( 'affwp_auto_complete_referral', '__return_false' ); 209 } else { 210 add_filter( 'affwp_auto_complete_referral', array( $this, 'maybe_disallow_complete_referral' ), 10, 2 ); 211 } 212 213 } 214 215 /** 216 * (Maybe) disallows a referral from being completed via complete_referral() in the Integrations API. 217 * 218 * @since 1.1.1 219 * 220 * @param bool $allow Whether to allow the referral to be completed. 221 * @param \AffWP\Referral $referral Referral object. 222 * @return bool True if the referral should continue to be processed as if Force Pending Referrals 223 * was not present, otherwise false. 224 */ 225 public function maybe_disallow_complete_referral( $allow, $referral ) { 226 if ( 'rejected' === $referral->status ) { 227 $set = affwp_set_referral_status( $referral, 'pending' ); 228 229 if ( true === $set ) { 230 affiliate_wp()->utils->log( 'Force Pending Referrals: Rejected referral successfully set to Pending.' ); 231 } else { 232 affiliate_wp()->utils->log( 'Force Pending Referrals: Rejected referral could not successfully be set to Pending.' ); 233 } 234 235 $allow = false; 236 237 } elseif ( 'pending' === $referral->status ) { 238 $allow = false; 239 } 240 241 return $allow; 207 242 } 208 243 -
affiliatewp-force-pending-referrals/trunk/readme.txt
r2553559 r2585159 3 3 Tags: AffiliateWP, affiliate, Pippin Williamson, Andrew Munro, mordauk, pippinsplugins, sumobi, ecommerce, e-commerce, e commerce, selling, membership 4 4 Requires at least: 5.0 5 Tested up to: 5. 75 Tested up to: 5. 6 6 Requires PHP: 5.6 7 Stable tag: 1.1 7 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 > This plugin requires [AffiliateWP](https://affiliatewp.com/ "AffiliateWP") 2.6+.<strong>It will NOT function without it.</strong>15 > This plugin requires [AffiliateWP](https://affiliatewp.com/ "AffiliateWP")<strong>It will NOT function without it.</strong> 16 16 17 17 Once activated, all referrals created by AffiliateWP will be forced to a status of "pending". … … 39 39 == Changelog == 40 40 41 42 43 41 44 = 1.1 = 42 45 * New: Enforce minimum dependency requirements checking
Note: See TracChangeset
for help on using the changeset viewer.