Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active May 24, 2018 14:53
Show Gist options
  • Save max-kk/69cc560e48e4d5fe20c35897ca9cfda6 to your computer and use it in GitHub Desktop.
Save max-kk/69cc560e48e4d5fe20c35897ca9cfda6 to your computer and use it in GitHub Desktop.
WC Wallet and WP Foto Vote
<?php
define("POINTS_PER_UPLOAD", 20);
/**
* Change money for upload
*/
add_action('fv/public/upload_after_insert', function($competitor_ID) {
$competitor = new FV_Competitor( $competitor_ID, false );
// TODO - change POINT
woo_wallet()->wallet->debit( $competitor->user_id, POINTS_PER_UPLOAD, "COntest Upload" );
});
add_filter('fv/upload-form/show-filter', function($false, $contest, $atts) {
$balance = (float) woo_wallet()->wallet->get_wallet_balance('get');
if ( !$balance || $balance < POINTS_PER_UPLOAD ) {
return "Insufficient Funds in Wallet. Kindly Add money to your Wallet to Continue";
}
return $false;
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment