How to disable referral link for specific users
If you want to hide referral link from specific customers. Copy the code below and change emails to emails of customers you want to hide referral link from.
add_filter('wpgens_raf_code','gens_raf_code',10,1); function gens_raf_code($raf_code) { $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { return 'Referral code is available only to Editors'; } return $raf_code; } add_filter('wpgens_raf_link','gens_raf_link',10,3); function gens_raf_link($raf_link, $referral_id, $type) { $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { return 'Referral link is available only to Editors'; } return $raf_link; } add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); } }
Change the text to the one you want to show for other user roles.