Give_Donate_Form::increase_earnings PHP Method

increase_earnings() public method

Increase the earnings by the given amount
Since: 1.0
public increase_earnings ( integer $amount ) : float | false
$amount integer Amount of donation. Default is 0.
return float | false
    public function increase_earnings($amount = 0)
    {
        $earnings = give_get_form_earnings_stats($this->ID);
        $new_amount = $earnings + (double) $amount;
        if ($this->update_meta('_give_form_earnings', $new_amount)) {
            $this->earnings = $new_amount;
            return $this->earnings;
        }
        return false;
    }

Usage Example

Exemplo n.º 1
0
/**
 * Increases the total earnings of a form.
 *
 * @since 1.0
 *
 * @param int $give_form_id Give Form ID
 * @param int $amount       Earnings
 *
 * @return bool|int
 */
function give_increase_earnings($give_form_id = 0, $amount)
{
    $form = new Give_Donate_Form($give_form_id);
    return $form->increase_earnings($amount);
}
All Usage Examples Of Give_Donate_Form::increase_earnings