Created
August 23, 2017 15:44
-
-
Save codelion7/9db458b8fdf74bfd1b7df4c45ffdae9c to your computer and use it in GitHub Desktop.
Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run if AffiliateWP MLM is Active | |
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) { | |
/** | |
* Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Downline Only) | |
* | |
* @since 1.1.1 | |
* @return array | |
*/ | |
function affwp_mlm_remove_downline_aff_data( $aff_data = array(), $affiliate_id = 0 ) { | |
if ( empty( $affiliate_id ) ) return $aff_data; | |
$current_affiliate_id = affwp_get_affiliate_id(); | |
$downline = affwp_mlm_get_downline( $current_affiliate_id ); | |
// Remove upline data | |
if ( in_array( $affiliate_id, $downline ) ) { | |
unset( $aff_data['referrals'] ); | |
unset( $aff_data['earnings'] ); | |
unset( $aff_data['sub_affiliates'] ); | |
} | |
return $aff_data; | |
} | |
add_filter( 'affwp_mlm_aff_data', 'affwp_mlm_remove_downline_aff_data', 10, 2 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment