Saqib Razzaq 2016-11-17 16:10:32 +05:00
parent d8d971e542
commit 0d5ec4d3f7
4 changed files with 48 additions and 11 deletions

View file

@ -1055,6 +1055,10 @@ class CBvideo extends CBCategory
'users' => $cb_columns->object('users')->temp_change('featured','user_featured')->get_columns()
);
if (!isset($fields['video_users'])) {
$fields[] = 'video_users';
}
$fields = tbl_fields( $fields );
if(!$params['count_only'] && !$params['show_related'])

View file

@ -100,3 +100,40 @@
}
}
/**
* Returns playable video for user's channel page
* @param : { array } { $userVideos } { an array user videos }
* @return : { string / boolean } { video key if found a video matches pattern else false }
* @since : November 17th, 2016 ClipBucket 2.8.2
* @author : Saqib Razzaq
*/
function userMainVideo($userVideos) {
global $userquery;
if (is_array($userVideos)) {
$userid = $userquery->userid;
foreach ($userVideos as $key => $video) {
$vBroadcast = trim($video['broadcast']);
switch ($vBroadcast) {
case 'private':
if (is_numeric($userid)) {
$allowedUsers = explode(',', $video['video_users']);
if (in_array($userid, $allowedUsers)) {
return $video;
}
}
break;
case 'logged':
if (is_numeric($userid)) {
return $video;
}
break;
case 'public':
return $video['videokey'];
break;
}
}
}
}

View file

@ -3,12 +3,16 @@
{lang code='channel' assign='object_type'}
{$loadMoreLang ={lang code="load_more"}}
{$uservideos=get_videos(["user"=>$user.userid, "order"=>"date_added DESC","limit" =>9])}
{if $uservideos}
{$first_video = $cbvid->get_video($uservideos.0.videokey)}
{/if}
{$total_videos = $user.total_videos}
{$total_photos = $user.total_photos}
{if $uservideos}
{$mainVideo = userMainVideo($uservideos)}
{$first_video = $cbvid->get_video($mainVideo)}
{/if}
<div id="main" class="container clearfix">
<div class="clearfix">
{include file="$style_dir/blocks/view_channel/channel_header.html"}

View file

@ -66,14 +66,6 @@ if($udetails)
$profile = $userquery->get_user_profile($udetails['userid']);
Assign('u_control', $profile);
// making sure user can see his private vid tab
//$user_cond = $userquery->userid != $udetails['userid'];
//Assign('u_cond', $user_cond);
$firstVideo = isset($videos[0]) ? $videos[0] : false;
$firstVideo = $cbvid->get_video($firstVideo['videoid']);
//echo "hm";
Assign('firstVideo', $firstVideo);
//Checking Profile permissions
$perms = $p['show_profile'];