/    Sign up×
Community /Pin to ProfileBookmark

Checking a wallet minimum amount

Currently, the php web script I’m using automatically defaults to the price of 2 credits, for all uploaded videos.
A user/uploader can go to his edit-video page and edit the price to any amount above the amount of 2, save/submit,
and the new price will be displayed in the next video search. If a u/u (user/uploader) tries to enter a price of less than 2,
the price automatically defaults back to 2.

I’m trying to work on modifying the script so that a zero can be entered into the edit-video > price field & then save/submit, which will display a new price of 0 in the next video search. And when the 0 priced video is selected, as a purchase, nothing will be deducted from the purchaser’s wallet, but an amount will be deducted from the u/u wallet – in other words, the u/u is providing his video for free to users and getting charged each time his video is selected.

I believe the modification should check a u/u wallet, for a minimum amount, upon his action of entering 0 into edit-video > price field upon save/submit. If the minimum amount is not there then error message and price automatically defaults back to 2.

Also, the modification should check a u/u wallet, for a minimum amount, upon his action of depleting his wallet amount by his own purchases. If he goes below a minimum amount, and is a u/u of a zero priced video, his video price should automatically defaults back to 2.

How can it check only u/u’s who change a price to zero, and not check everyone who purchases a video?
What am I not considering? What would be needed to make this modification feasible? What would be a better (maybe easier) solution?

Here’s some current code:

“`
$min_price=$config[‘video_play_price’];
$temp_price = $videos[‘video_play_price’];
if ($temp_price<$min_price) { $temp_price = $min_price;}
“`

any comments/guidance is appreciated

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 10.2019 — Maybe this is what you need?
<i>
</i>if($temp_price != 0 and $temp_price &lt; $min_price) {
Copy linkTweet thisAlerts:
@chrisjchrisjauthorDec 11.2019 — Thanks for your reply.

So, if replaced my line of code with your line of code and completed it like so:

if($temp_price != 0 and $temp_price &lt; $min_price) {$temp_price = $min_price;}

it is saying: if the temporary price isn't 0 and the temp price is less than the minimum price, then update the temporary price to equal the minimum price, correct?

If that's correct, then I need help with code, I believe, that would say if the price is 0, then deduct 1 credit from the u/u account each time the 0 priced video is selected. Correct?

I look forward to any additional guidance.
×

Success!

Help @chrisjchrisj spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...