Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Goran87

    (@goran87)

    In public/class-gens-raf-public.php, find account_page_show_link() method, and in there just check if its admin user, if so dont show. That will fix it.

    Thread Starter Jason Wong

    (@eljkmw)

    Instead of hacking into your lovely source code, I’ve inserted this snippet into functions.php, and sadly it didn’t work.

    function remove_referral_link() {
    	if ( current_user_can( 'manage_options' ) ) {
    		remove_action( 'woocommerce_before_my_account', 'account_page_show_link' );
    	}
    }
    add_action( 'init', 'remove_referral_link' );

    What am I missing?

    Thread Starter Jason Wong

    (@eljkmw)

    Looks like there’s no hook available to make it work. Sigh …
    In the end, the following was changed in /public/class-gens-raf-public.php

    public function account_page_show_link() {
    
    	$referral_id = $this->get_referral_id( get_current_user_id() );
    	$refLink = esc_url(add_query_arg( 'raf', $referral_id, get_home_url() ));
    
    	// for non Administrator and Shop Manager user roles
    	if ( ! current_user_can( 'manage_options' ) ) {
    ?>
    	<div class="woocommerce-message"><?php _e( 'Your Referral URL:','gens-raf'); ?> <a href="<?php echo $refLink; ?>" ><?php echo $refLink; ?></a></div>
    <?php
    	}
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove referral link on My Account for admin?’ is closed to new replies.