• HI,

    Great plugin ??

    I have a problem and don’t to know how to fix it in PHP.

    1. I want to add a Affiliates All Menu links in my Default Woocommerce My Account Page. With code I need to add to view all Affiliates Dashboard links under a Default Links Woocommerce.

    Or.

    2. This same like 1, but all affiliates dashboard links enables only when user login in his affiliates account, then all affiliates links automatically activates in Default My Account Woo page.

    I hope You understand me, I dont want to create ex. another Custom My Account Page ( another plugin, another theme, so necessary another plugin) I hope my problem can fix by just add needed PHP code in the custom plugin:)

    Regards.

Viewing 1 replies (of 1 total)
  • Plugin Support Iván Sosa

    (@ivansosa)

    Hi there,

    hope you are doing well! ??

    you can add a new endpoint of the affiliate dashboard, adding this custom code in the functions.php of your active theme:

    if ( defined( 'YITH_WCAF' ) && ! function_exists( 'yith_wcaf_add_affiliate_dashboard_to_account_menu_items' ) ) {
    	function yith_wcaf_add_affiliate_dashboard_to_account_menu_items( $items ) {
    
    		if ( is_user_logged_in() ) {
    			$is_affiliate = false;
    
    			$affiliates   = YITH_WCAF_Affiliate_Handler()->get_affiliates( array( 'user_id' => wp_get_current_user()->ID ) );
    			$is_affiliate = isset( $affiliates[0] );
    
    			if ( ! $is_affiliate ) {
    				return $items;
    			}
    
    			$items = array_merge(
    				$items,
    				array(
    					'affiliate-dashboard' => __( 'Affiliate Dashboard', 'yith-wcaf' )
    				)
    			);
    		}
    
    		return $items;
    	}
    
    	add_filter( 'woocommerce_account_menu_items', 'yith_wcaf_add_affiliate_dashboard_to_account_menu_items' );
    }
    
    if ( defined( 'YITH_WCAF' ) && ! function_exists( 'yith_wcaf_change_affiliate_dashboard_endpoint_url' ) ) {
    	function yith_wcaf_change_affiliate_dashboard_endpoint_url( $url, $endpoint ) {
    
    		$is_affiliate = false;
    		if ( is_user_logged_in() ) {
    			$affiliates   = YITH_WCAF_Affiliate_Handler()->get_affiliates( array( 'user_id' => wp_get_current_user()->ID ) );
    			$is_affiliate = isset( $affiliates[0] );
    		}
    
    		if ( ! $is_affiliate ) {
    			return $url;
    		}
    
    		if ( 'affiliate-dashboard' == $endpoint ) {
    			$url = untrailingslashit( YITH_WCAF()->get_affiliate_dashboard_url() );
    		}
    
    		return $url;
    	}
    
    	add_filter( 'woocommerce_get_endpoint_url', 'yith_wcaf_change_affiliate_dashboard_endpoint_url', 10, 2 );
    }

    Try it and let us know if everything works fine.

    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘How to Customized Affilates PRO DashBoard in Default Dasboard Woocommerce’ is closed to new replies.