Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created July 25, 2018 18:06
Show Gist options
  • Select an option

  • Save wbcomdev/08325ae77d97ee0c8a2c5c6e8eb44dd2 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/08325ae77d97ee0c8a2c5c6e8eb44dd2 to your computer and use it in GitHub Desktop.
Affiliate Total Unpaid Earning tile
Please navigate to file includes/admin/reports/tabs/class-referrals-reports-tab.php and replace the total unpaid earning tile code with the following code:
$total_unpaid_earnings = 0;
$referrals = affiliate_wp()->referrals->get_referrals( array(
'number' => -1,
'status' => 'unpaid',
'affiliate_id' => $this->affiliate_id,
'date' => $this->date_query ? $this->date_query : ''
) );
foreach ( $referrals as $referral ) {
$total_unpaid_earnings += $referral->amount;
}
$this->register_tile( 'affiliate_unpaid_earnings', array(
'label' => __( 'Total Unpaid Earnings', 'affiliate-wp' ),
'type' => $total_unpaid_earnings ? 'amount' : '',
'context' => 'secondary',
'data' => $total_unpaid_earnings ? $total_unpaid_earnings : __( 'None', 'affiliate-wp' ),
'comparison_data' => sprintf( __( 'Affiliate: <a href="%1$s">%2$s</a> | %3$s', 'affiliate-wp' ),
esc_url( $affiliate_link ),
$affiliate_name,
$this->get_date_comparison_label()
),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment