/    Sign up×
Community /Pin to ProfileBookmark

Help with allowing User to change set pricing

The php web video script that I’m using works successfully where Users can edit the price of their uploaded video (the minimum price is set in the admin panel for all uploaded videos). But, I am looking for assistance with modifying so that just one user/uploader (named “Admin”) can set a price lower than the minimum. Here is the edit-video.php file code:

[code]

<?php
if (IS_LOGGED == false) {
header(“Location: ” . PT_Link(‘login’));
exit();
}
if (empty($_GET[‘id’])) {
header(“Location: ” . PT_Link(‘login’));
exit();
}
$id = PT_Secure($_GET[‘id’]);
$video = $db->where(‘id’, $id)->getOne(T_VIDEOS);
if (empty($video)) {
header(“Location: ” . PT_Link(‘login’));
exit();
}
if (!PT_IsAdmin()) {
if (empty($db->where(‘id’, $id)->where(‘user_id’, $user->id)->getValue(T_VIDEOS, ‘count(*)’))) {
header(“Location: ” . PT_Link(‘login’));
exit();
}
}
$video = PT_GetVideoByID($video, 0, 0, 0);
$pt->video = $video;
$pt->page = ‘edit-video’;
$pt->title = $lang->edit_video . ‘ | ‘ . $pt->config->title;
$pt->description = $pt->config->description;
$pt->keyword = $pt->config->keyword;

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

$pt->content = PT_LoadPage(‘edit-video/content’, array(
‘ID’ => $video->id,
‘USER_DATA’ => $video->owner,
‘THUMBNAIL’ => $video->thumbnail,
‘URL’ => $video->url,
‘TITLE’ => $video->title,
‘DESC’ => br2nl($video->edit_description),
‘DESC_2’ => $video->markup_description,
‘VIEWS’ => $video->views,
‘TIME’ => $video->time_ago,
‘TAGS’ => $video->tags,
‘video_play_price_user’ => number_format( $video->video_play_price < $config[‘video_play_price’] ? $config[‘video_play_price’] : $video->video_play_price)
));

[/code]

any assistance with this modification is appreciated

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 09.2019 — If I'm guessing correctly what the PT_IsAdmin() function does, you could change this line...
<i>
</i>if ($temp_price&lt;$min_price) { $temp_price = $min_price;}

...to this...
<i>
</i>if ($temp_price &lt; $min_price and !PT_IsAdmin()) {
$temp_price = $min_price;
} // I'm a fan of consistent formatting versus one-liners. ;)
Copy linkTweet thisAlerts:
@chrisjchrisjauthorMay 09.2019 — Thanks for your reply.

I tried your suggestion without success, meaning that I was unable to change the price of the video that the user named "admin" uploaded, to a price below the price set at the Admin panel, via the edit video field on the edit video page.

I'm not sure but it may be that PT_IsAdmin doesn't refer to the user named 'admin'.

Any additional assistance is appreciated.
×

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.10,
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,
)...