• Resolved Vic

    (@itutorua)


    Hi,
    Thanks for a great plugin!

    Is it possible to display a referral user First/Last Name and Email in the Affiliates Dashboard > Commissions tab?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hi there,
    we hope you’re doing well and thanks for your words!

    Could you tell us in what position you want to place the affiliate information? It could be above or below the table.

    Please let me know.

    Best regards.

    Thread Starter Vic

    (@itutorua)

    Hi,
    Thanks for your reply! It doesn’t really matter where it can go. Maybe something like that

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    sorry for the delay.

    In order to achieve what you need, please add the following code in the functions.php file of your active theme:

    if ( ! function_exists( 'yith_wcaf_dashboard_commissions_table_columns' ) ) {
    function yith_wcaf_dashboard_commissions_table_columns( $columns ) {
    $columns['user_name'] = 'Referral name';
    $columns['user_email'] = 'Referral email';
    return $columns;
    }
    add_filter( 'yith_wcaf_dashboard_commissions_table_columns', 'yith_wcaf_dashboard_commissions_table_columns' );
    }

    if ( ! function_exists( 'yith_wcaf_dashboard_commissions_table_render_user_name_column' ) ) {
    function yith_wcaf_dashboard_commissions_table_render_user_name_column( $commission ) {
    $affiliate_id = $commission['affiliate_id'];
    $affiliate = YITH_WCAF_Affiliate_Factory::get_affiliate_by_id( $affiliate_id );

    $username = $affiliate->get_first_name() . ' ' . $affiliate->get_last_name();

    echo wp_kses_post( $username );
    }

    add_action( 'yith_wcaf_dashboard_commissions_table_render_user_name_column', 'yith_wcaf_dashboard_commissions_table_render_user_name_column' );
    }
    if ( ! function_exists( 'yith_wcaf_dashboard_commissions_table_render_user_email_column' ) ) {
    function yith_wcaf_dashboard_commissions_table_render_user_email_column( $commission ) {
    $affiliate_id = $commission['affiliate_id'];
    $affiliate = YITH_WCAF_Affiliate_Factory::get_affiliate_by_id( $affiliate_id );
    $user = $affiliate->get_user();

    $useremail = sanitize_email( $user->user_email ) ;

    echo wp_kses_post( $useremail );
    }

    add_action( 'yith_wcaf_dashboard_commissions_table_render_user_email_column', 'yith_wcaf_dashboard_commissions_table_render_user_email_column' );
    }

    Check it out and tell us if it works well for you, please.

    Best regards.

    Thread Starter Vic

    (@itutorua)

    Hi Juan,

    Thanks for the follow-up. This seems to be working!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Referral Name and Email’ is closed to new replies.