Article Details
Videos Permission-Allow guess to see video page but force login to watch video
if you are using the default phpfox view.html page just open /www/module/video/template/default/controller/view.html.php
and replace the entire code with this
TUTORIAL WITH TEXT
SEE BELOW FOR TUTORIAL WITH LOGIN BLOCK INSTEAD
HTML:
<?php /** * [PHPFOX_HEADER] * * @copyright [PHPFOX_COPYRIGHT] * @author Raymond Benc * @package Phpfox * @version $Id: controller.html.php 64 2009-01-19 15:05:54Z Raymond_Benc $ */ defined('PHPFOX') or exit('NO DICE!'); ?> <div class="main_break"></div> <div id="js_video_edit_form_outer" style="display:none;"> <form method="post" action="#" onsubmit="$(this).ajaxCall('video.viewUpdate'); return false;"> <div><input type="hidden" name="val[is_inline]" value="true" /></div> <div id="js_video_edit_form"></div> <div class="table_clear"> <input type="submit" value="{phrase var='video.update'}" class="button" /> - <a href="#" id="js_video_go_advanced">{phrase var='video.go_advanced'}</a> - <a href="#" onclick="$('#js_video_edit_form_outer').hide(); $('#js_video_outer_body').show(); return false;">{phrase var='video.cancel'}</a> </div> </form> </div> <div id="js_video_outer_body"> {if $aVideo.in_process > 0} <div class="message"> {phrase var='video.video_is_being_processed'} </div> {/if} {if $aVideo.view_id == 2} <div class="message"> {phrase var='video.video_is_pending_approval'} </div> {/if} {if !Phpfox::IsUser()} YOU MUST LOGIN TO SEE THIS VIDEO <a href="http://www.phpfox.com/user/login/">CLICK HERE TO LOGIN</a> OR <a href="http://www.phpfox.com/user/register/">{phrase var='user.menu_register'}</a> {/if} {if Phpfox::isUser()} <div class="t_center"> {if $aVideo.is_stream} {$aVideo.embed_code} {else} <div id="js_video_player" style="width:630px; height:386px; margin:auto;{if $aVideo.in_process > 0} display:none;{/if}"></div> {/if} {/if} <div class="video_share_box"> {if Phpfox::isModule('favorite')} <a href="#?call=favorite.add&height=100&width=400&type=video&id={$aVideo.video_id}" class="inlinePopup" title="{phrase var='video.add_to_your_favorites'}">{img theme='misc/icn_save.png' class='v_middle'} {phrase var='video.favorite'}</a> {/if} {if Phpfox::isModule('share')} {module name='share.link' type='video' display='image' url=$aVideo.bookmark title=$aVideo.title} {/if} {if Phpfox::isModule('report')} {if $aVideo.user_id != Phpfox::getUserId()}<a href="#?call=report.add&height=100&width=400&type=video&id={$aVideo.video_id}" class="inlinePopup" title="{phrase var='video.report_a_video'}">{img theme='misc/icn_report.png' class='v_middle'} {phrase var='video.report'}</a>{/if} {/if} </div> </div> <p style="margin-top:5px;" id="js_video_text_{$aVideo.video_id}"> {$aVideo.text|parse|shorten:'500':'video.view_more':true} </p> {plugin call='video.template_default_controller_view_extra_info'} {module name='comment.display' sType='video' iItemId=$aVideo.video_id iTotal=$aVideo.total_comment} </div>
or edit the file like this
open /www/module/video/template/default/controller/view.html.php
look for
HTML:
<div class="t_center">
{if $aVideo.is_stream}and above that add
HTML:
{if !Phpfox::IsUser()}
YOU MUST LOGIN TO SEE THIS VIDEO <a href="http://www.phpfox.com/user/login/">CLICK HERE TO LOGIN</a> OR <a href="http://www.phpfox.com/user/register/">{phrase var='user.menu_register'}</a>
{/if}
{if Phpfox::isUser()}then look for
HTML:
<div id="js_video_player" style="width:630px; height:386px; margin:auto;{if $aVideo.in_process > 0} display:none;{/if}"></div> {/if}
and after that add a close if tag like this
HTML:
{/if}you can replace the line
HTML:
YOU MUST LOGIN TO SEE THIS VIDEO <a href="http://www.phpfox.com/user/login/">CLICK HERE TO LOGIN</a> OR <a href="http://www.phpfox.com/user/register/">{phrase var='user.menu_register'}</a>
with your own text or add a cool image instead :D
WITH LOGIN BLOCK INSTEAD OF TEXT
see the pic
to do this just replace the code from instruction above
HTML:
YOU MUST LOGIN TO SEE THIS VIDEO <a href="http://www.phpfox.com/user/login/">CLICK HERE TO LOGIN</a> OR <a href="http://www.phpfox.com/user/register/">{phrase var='user.menu_register'}</a>
With
HTML:
<h2>YOU MUST LOGIN TO SEE THIS VIDEO </h2>{module name='user.login-ajax'}<br />
let me know if it worked for you
Comments
Beciowa wrote at May 8, 2011, 11:49 am
Heya,
this modification doesn't work anymore when you add Lings videoplayer.
Does somebody know where to add the code so that it works also with that videoplayer?
TSM wrote at February 16, 2011, 7:15 pm
Hi there
Great mod - thanks!
COuld you tell me what I need to change to make it so existing users (free) are required to upgrade before they can view the videos?
I assume the conde below needs to be changed.
{if !Phpfox::IsUser()}
to something like
{if !Phpfox::RegisteredUser()} ??????
Many thanks
Mike



