Plugin Directory

Changeset 2585159

Timestamp:
08/19/2021 04:04:16 AM (3 years ago)
Author:
DrewAPicture
Message:

Version 1.1.1 Release.

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  
    66 * Author: Sandhills Development, LLC
    77 * Author URI: https://sandhillsdev.com
    8  * Version: 1.1
     8 * Version: 1.1
    99 * License: GPL-2.0+
    1010 * 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  
    4242         * @var   string
    4343         */
    44         private $version = '1.1';
     44        private $version = '1.1';
    4545
    4646        /**
     
    202202            add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), null, 2 );
    203203
    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;
    207242        }
    208243
  • affiliatewp-force-pending-referrals/tags/1.1.1/readme.txt

    r2553559 r2585159  
    33Tags: AffiliateWP, affiliate, Pippin Williamson, Andrew Munro, mordauk, pippinsplugins, sumobi, ecommerce, e-commerce, e commerce, selling, membership
    44Requires at least: 5.0
    5 Tested up to: 5.7
     5Tested up to: 5.
    66Requires PHP: 5.6
    7 Stable tag: 1.1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    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>
    1616
    1717Once activated, all referrals created by AffiliateWP will be forced to a status of "pending".
     
    3939== Changelog ==
    4040
     41
     42
     43
    4144= 1.1 =
    4245* New: Enforce minimum dependency requirements checking
  • affiliatewp-force-pending-referrals/trunk/affiliatewp-force-pending-referrals.php

    r2553492 r2585159  
    66 * Author: Sandhills Development, LLC
    77 * Author URI: https://sandhillsdev.com
    8  * Version: 1.1
     8 * Version: 1.1
    99 * License: GPL-2.0+
    1010 * License URI: http://www.opensource.org/licenses/gpl-license.php
  • affiliatewp-force-pending-referrals/trunk/includes/class-affiliatewp-force-pending-referrals.php

    r2553492 r2585159  
    4242         * @var   string
    4343         */
    44         private $version = '1.1';
     44        private $version = '1.1';
    4545
    4646        /**
     
    202202            add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), null, 2 );
    203203
    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;
    207242        }
    208243
  • affiliatewp-force-pending-referrals/trunk/readme.txt

    r2553559 r2585159  
    33Tags: AffiliateWP, affiliate, Pippin Williamson, Andrew Munro, mordauk, pippinsplugins, sumobi, ecommerce, e-commerce, e commerce, selling, membership
    44Requires at least: 5.0
    5 Tested up to: 5.7
     5Tested up to: 5.
    66Requires PHP: 5.6
    7 Stable tag: 1.1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    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>
    1616
    1717Once activated, all referrals created by AffiliateWP will be forced to a status of "pending".
     
    3939== Changelog ==
    4040
     41
     42
     43
    4144= 1.1 =
    4245* New: Enforce minimum dependency requirements checking
Note: See TracChangeset for help on using the changeset viewer.