Skip to content

Instantly share code, notes, and snippets.

@codelion7
Created March 5, 2021 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codelion7/e6a7ad69cb76b09be7b06d1b74d92921 to your computer and use it in GitHub Desktop.
Save codelion7/e6a7ad69cb76b09be7b06d1b74d92921 to your computer and use it in GitHub Desktop.
Add the Affiliate's Email Address to the Affiliate Data Dropdown in the Tree View (AffiliateWP MLM)
// Run if AffiliateWP MLM is Active
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) {
/**
* Adds Affiliate URL to Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
*
* @since 1.1.6
* @return array
*/
function affwp_mlm_add_email_aff_data( $aff_data = array(), $affiliate_id = 0, $disabled_aff_data = array() ) {
if ( empty( $affiliate_id ) ) return $aff_data;
if ( isset( $disabled_aff_data['info'] ) ) return $aff_data;
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = get_userdata( $user_id );
$email = $user->user_email;
$aff_data['info']['content']['email'] = $email;
return $aff_data;
}
add_filter( 'affwp_mlm_aff_data', 'affwp_mlm_add_url_aff_data', 10, 2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment