Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/3d3e932fddc9c36abc87 to your computer and use it in GitHub Desktop.
Save amdrew/3d3e932fddc9c36abc87 to your computer and use it in GitHub Desktop.
AffiliateWP + WooCommerce - Add link through to user's profile screen from the reference column of the referrals page
<?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