Created
April 28, 2020 08:09
-
-
Save ucheng/cf7f88d3b0c56ab0f7b620fd325233a3 to your computer and use it in GitHub Desktop.
show customer linked affiliate
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_action('show_user_profile', 'mys_additional_profile_fields', 9); | |
| add_action('edit_user_profile', 'mys_additional_profile_fields', 9); | |
| function mys_additional_profile_fields($user) | |
| { | |
| echo '<h2>連結的推薦人</h2>'; | |
| $customer = affwp_get_customer($user->user_email); | |
| $linked_affiliate_id = affwp_get_customer_meta($customer->customer_id, 'affiliate_id'); | |
| if (!empty($linked_affiliate_id) && $linked_affiliate_id[0]) { | |
| $user_id = affwp_get_affiliate_user_id($linked_affiliate_id[0]); | |
| $user_info = get_userdata($user_id); | |
| $link = get_edit_user_link($user_id); | |
| echo '<a href="' . $link . '">' . $user_info->display_name . '(' . $user_info->user_email . ')</a>'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment