Last active
May 24, 2018 14:53
-
-
Save max-kk/69cc560e48e4d5fe20c35897ca9cfda6 to your computer and use it in GitHub Desktop.
WC Wallet and WP Foto Vote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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