コード例 #1
0
 function test_get_affiliate_unpaid_earnings()
 {
     $this->assertEquals(0, affwp_get_affiliate_unpaid_earnings($this->_affiliate_id));
     $this->assertEquals('$0', affwp_get_affiliate_unpaid_earnings($this->_affiliate_id, true));
 }
コード例 #2
0
	<h4>Stats Overview</h4>

	<table class="affwp-table" style="width:100%">
		<thead>
			<tr>
				<th>Weekly Earnings</th>
				<th>Total Earnings</th>
				<th>Weekly Referrals</th>
				<th>Total Referrals</th>
			</tr>
		</thead>

		<tbody>
			<tr>
				<td><?php 
echo affwp_get_affiliate_unpaid_earnings(affwp_get_affiliate_id(), true);
?>
</td>
				<td><?php 
echo affwp_get_affiliate_earnings(affwp_get_affiliate_id(), true);
?>
</td>
				<td><?php 
echo affwp_count_referrals(affwp_get_affiliate_id(), 'unpaid');
?>
</td>
				<td><?php 
echo affwp_count_referrals(affwp_get_affiliate_id(), 'paid');
?>
</td>
			</tr>
 /**
  * Show an affiliate's total unpaid/paid earnings
  *
  * [affiliate_earnings status="paid"]
  * [affiliate_earnings status="unpaid"]
  *
  * @since  1.1
  */
 function affiliate_earnings($atts, $content = null)
 {
     if (!(affwp_is_affiliate() && affwp_is_active_affiliate())) {
         return;
     }
     $atts = shortcode_atts(array('status' => ''), $atts, 'affiliate_earnings');
     switch ($atts['status']) {
         case 'paid':
             $content = affwp_get_affiliate_earnings(affwp_get_affiliate_id(), true);
             break;
         case 'unpaid':
             $content = affwp_get_affiliate_unpaid_earnings(affwp_get_affiliate_id(), true);
             break;
     }
     return do_shortcode($content);
 }