The php web video script that I’m using calculates the cost of the video. All uploaded videos are priced at what the Admin has set in admin panel, (but after uploading the uploader can change the price). All that works successfully.
I’m trying to add the ability where the default price set by Admin is the Minimum Price, so uploaders can’t price a video below that (currently an uploader can change to any price - from his logged-in account).
I have gotten so far as to have the Minimum Price now display - as the Purchase Price on the listed videos page (when the User tries to set a lower price than Minimum Price), but, the actual purchase reflects the uploaders’ lower price, not the displayed Minimum Price.
Whenever a User/Uploader changes the price in his account >edit-video form, the number reflected in videos (table) > video_play_price (column) is updated.
But, it appears that the minimum price is not being updated in videos (table)> video_play_price (column), (because it remains at the less-than the minimum price).
So, I need help with updating the Minimum price - in the video_play_price column.
The solution needed might be in this part of code in the
…/layout/edit-video/content.html file:
<div class="form-group">
<label class="col-md-12" for="cost">{{LANG up_video_price}}</label>
<div class="col-md-12">
<input id="cost" input type="number" name="video_play_price" class="form-control input-md" value="{{video_play_price_user}}">
</div>
</div>
</div>
Or in the…/sources/edit-video/content.php file:
<?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' => $u_paid_videos->video_play_price,
//'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'])
'video_play_price_user' => number_format( $video->video_play_price < $config['video_play_price'] ? $config['video_play_price'] : $video->video_play_price)
));
Or in the this section of the …/ajax/edit-video/content.php file:
$video_play_price = floatval(PT_Secure($_POST['video_play_price']));
if ( $video_play_price < $config[‘video_play_price’] ) {
$video_play_price = $config['video_play_price'];
}
$data_update = array(
'title' => PT_Secure($_POST['title']),
'description' => PT_Secure($_POST['description']),
'tags' => PT_Secure($_POST['tags']),
'category_id' => $category_id,
'featured' => $featured,
'thumbnail' => $thumbnail,
'privacy' => $video_privacy,
'age_restriction' => $age_restriction,
'video_play_price' => $video_play_price,
);
,,,,,
Any suggestions will be appreciated.