vendredi 27 novembre 2015

wordpress plugin WPdeposit, how to use the functions

I have installed the plugin WPdeposit on my wordpress site, it allows users to deposit into their account balance. I am trying to manipulate users balances when they press an anchor tag on the page.

In the directory plugins/models/user.php there are many functions, I think im interested in this one:

 /**
 * Update Regular balance to given amount (Will overwrite whatever value is in the db!)
 *
 * @param int $amount
 * @return boolean
 */
public function updateRegularBalance($amount) {
    if (floatval($amount)) {
        return (bool) update_user_meta($this->_id, WPDEPOSIT_NAME.self::USER_AMOUNT, $amount);
    } else {
        throw new \Exception(__('Amount is not a number', WPDEPOSIT_NAME));
    }
}

when I try to call this function to the page on the theme's index.php like so:

updateRegularBalance(5);

but I receive this error. Fatal error: Call to undefined function updateRegularBalance()

is there a way to access the use of this function so I can pass in the value I want to update the balance to?




Aucun commentaire:

Enregistrer un commentaire