当我进行两次捐赠时,它仅显示最近的捐赠,而没有显示两次捐赠的总数

时间:2019-11-01 14:51:29

标签: php wordpress

我有一个捐赠页面:gesher-jds.org/giving-tuesday,当一个人捐赠超过一次时,它仅显示他最近的捐赠(在捐赠列表中),而不显示他的捐赠总数(金额钱)。

<div class="donors_info">
    <div class="totalenteries"></div>
    <?php
        $valueid = 2727;
        //Get donors based on forms IDs (can be single or multiple forms)
        if(function_exists('give_get_payments')) {
            $args = array(
                'give_forms' => $valueid,
                'number' => -1,
            );
            $donations = give_get_payments( $args );

            echo "<table id='dtab'>";
            echo "<thead>";
            echo "<th align='center'>" . 'Name' . "</th>";
            echo "<th align='center'>" . 'Amount' . "</th>";
            echo "</thead>";
            echo "<tbody>";
            $donors = array();
            foreach($donations as $donation) {                              
                //Now get donor information from this donation ("customer" aka "donor")
                $customer_id = give_get_payment_customer_id( $donation->ID );
                $customers    = new Give_Customer( $customer_id );

                $nameis = $customers->name;
                if (in_array($nameis, $donors)) {} else {   
                    $amt = get_post_meta($donation->ID,'_give_payment_total',true) + 0;         
                    echo "<tr class='select'>";
                    echo "<td align='left'>" . $nameis . "</td>";
                    echo "<td align='center'>" . $purchaseis = "$" . $amt . "</td>";
                    echo "</tr>";
                    $donors[] = $nameis;
                }
            }
            echo "</tbody>";
            echo "</table>";
        }
    ?>
</div>

0 个答案:

没有答案