Hi there, featured vids are only tied to accounts and not by pages. We can not feature a vid from a page.

I am a coder and I am going to code this to work but if anyone out there has the code to make it all work and look nice for featuring videos from pages please let me know. This is a strange thing, I assumed we could feature videos from pages...guess not?
Be the first person to like this.
Has anyone got their site setup to allow for featuring videos from pages? Looks like there is a little bit to this - any ideas?
Be the first person to like this.
Donna(data66)
Merged duplicates. Don't post duplicates. You could file a feature request for this.
Be the first person to like this.
OK. So has anyone ever done it before though? I can't be the first one who wanted to feature a page video?
Be the first person to like this.
Donna(data66)
I've Not Seen It Asked Before That I Can Recall. I'm On Droid, Please Excuse The Caps.
Be the first person to like this.
webwolf
This looked like an interesting puzzle for today. I thought it might be easy to set up. It turned out to be a little more complicated than I had hoped, but it can be done (barring any unforeseen side effects).

It looks like the only reason that you can't feature a video in the pages section is that the template code prevents the selections from appearing. The easy solution to this is to change the template to do what you want, but that would represent a bad practice, so I will provide this other solution.

Within the file /module/video/template/default/block/entry.html.php is a hook called video.template_block_entry_3. We can use that to insert the feature options back into the menu. Create a file called video.template_block_entry_3.php and place it into the module/video/include/plugin folder. Place this code within the file:
PHP:
//Get the video data for this entry
$aVideo=$this->getVar('aVideo');

// Only show the menu item to those who can use them

if(Phpfox::getUserParam('video.can_feature_videos_') && defined('PHPFOX_IS_PAGES_VIEW'))
{
    echo 
'<li id="js_feature_' $aVideo['video_id'] . '" ';
    if(
$aVideo['is_featured'] == 1)
    {
        echo 
'style="display:none;"';
    }
    echo 
'><a href="#" title="' Phpfox::getPhrase('video.feature_this_video') . '" onclick="$(this).parent().hide();'
    echo 
" $('#js_unfeature_$aVideo['video_id'] . "').show(); $(this).parents('.js_video_parent:first').addClass('row_featured_image').find('.js_featured_video:first').show(); ";
    echo 
"$.ajaxCall('video.feature', 'video_id=" $aVideo['video_id'] . "&type=1'); return false;";
    echo 
'">' Phpfox::getPhrase('video.feature') . '</a></li>';

    echo 
'<li id="js_unfeature_' $aVideo['video_id'] . '" ';
    if(
$aVideo['is_featured'] != 1)
    {
        echo 
'style="display:none;"';
    }
    echo 
'><a href="#" title="' Phpfox::getPhrase('video.un_feature_this_video') . '" onclick="$(this).parent().hide();';
    echo 
" $('#js_feature_$aVideo['video_id'] . "').show(); $(this).parents('.js_video_parent:first').removeClass('row_featured_image').find('.js_featured_video:first').hide(); ";
    echo 
"$.ajaxCall('video.feature', 'video_id=" $aVideo['video_id'] . "&type=0'); return false;";
    echo 
'">' Phpfox::getPhrase('video.un_feature') . '</a></li>';



This should allow you to feature a video and it will show up in the featured video block. It will not, however, show in the site video page when you select 'featured videos', because the selection code purposefully does not select page videos.

If you want them to show on this page, you can do so by adding two more plugins. Create a file called video.component_controller_index_switch_sview.php and place it in the same plugin folder as the first plugin. Within this file add the code:
PHP:
//Set this variable so we can define the default handler later
$bRunPlugin true;
// return true so that this plugin handler does not interrupt the program flow
return true

Finally make a third plugin n the same directory and name it video.component_controller_index_switch.php and place this code within:
PHP:
if ($bIsUserProfile)
{
    
$this->search()->setCondition('AND m.in_process = 0 AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' '= 0') . ' AND m.item_id = 0 AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' Phpfox::getService('core')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
}
else
{            
    if (
defined('PHPFOX_IS_PAGES_VIEW'))
    {
        
$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.module_id = '' . Phpfox::getLib('database')->escape($aParentModule['module_id']) . '' AND m.item_id = ' . (int) $aParentModule['item_id'] . ' AND m.privacy IN(%PRIVACY%)');
    }
    else
    {
        
$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.item_id ' . ($sView=='featured' '>=0 ' '=0') . ' AND m.privacy IN(%PRIVACY%)');
    }


Now, clear your cache and try it out. If it doesn't work the first time,try playing with the admincp cache plugin settings. Also, there may be good reasons why Phpfox didn't allow pages video to be featured. Keep this in mind as you evaluate the modification.
Last update on December 1, 2013 by webwolf.
Be the first person to like this.
OK. Thanks that is very interesting!

I created the video.template_block_entry_3.php file but I am not seeing where it is being called. Note that I am using a theme as well - not default. Adding this file does not add 'feature video' to the menu.
Be the first person to like this.
I got it - that worked!! Very cool.
Be the first person to like this.
Thanks!
Be the first person to like this.
That is very cool thanks! An interesting thing now, when I go to video my feed link in the main menu is selected.
Be the first person to like this.
When I go to the video page for a specific profile it loads all videos...? I would still want the video page of a specific profile to load the videos particular to that page/user. Any ideas?
Be the first person to like this.
webwolf
I looked at my test site and it did not seem to have this issue.

The third plugin deals with setting up the conditions for retrieving the videos, but they are just copied from the code that it is replacing with the exception of some alterations in the coding for featured videos. Also, the conditional statement were changed a little to make sense in it's new environment.
The first conditional statement deals with profiles. if the $bIsUserProfile is set it should set the where code up to only select from that user's videos. If for some reason it failed that test, it would fall down to the coding that would be for selecting on the site video page, which sounds like your issue.

That is my best guess about where to look.
Last update on December 2, 2013 by webwolf.
Be the first person to like this.
This problem is actually still happening...I have to sort it out over the next week.
Be the first person to like this.