Last active
August 29, 2015 14:08
AffiliateWP + WooCommerce - Add link through to user's profile screen from the reference column of the referrals page
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
<?php | |
/** | |
* Add link through to user's profile screen from the reference column of the referrals page | |
*/ | |
function affwp_custom_wc_referrals_user_link( $reference, $referral ) { | |
if ( ! ( 'woocommerce' == $referral->context || class_exists( 'WC_Order' ) ) ) { | |
return $reference; | |
} | |
$order = new WC_Order( $referral->reference ); | |
$user_id = $order->user_id; | |
$user_info = get_userdata( $user_id ); | |
$user_name = $user_info->user_login; | |
if ( $user_id ) { | |
return $reference . '<br/><a href="' . get_edit_user_link( $user_id ) . '">' . $user_name . '</a>'; | |
} | |
return $reference; | |
} | |
add_filter( 'affwp_referral_reference_column', 'affwp_custom_wc_referrals_user_link', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment