How Can I add Video on Knowledge base

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
clio_pasta
Posts: 8
Joined: Fri Jan 22, 2016 8:54 pm

How Can I add Video on Knowledge base

Post by clio_pasta »

Hi,

instead of posting a link for video, I want customer see the video and just click "play" to watch the tutorial.

Please advise if possible
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Re: How Can I add Video on Knowledge base

Post by Klemen »

There is a "HTML" button allowing you to modify article source code directly.

For example to show a Youtube video, you can add such an iframe:

Code: Select all

<iframe width="330" height="240" src="http://www.youtube.com/embed/9ZIrYLiv9lI" frameborder="0" allowfullscreen></iframe>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
faruxx
Posts: 3
Joined: Wed Mar 18, 2015 12:32 pm

Re: How Can I add Video on Knowledge base

Post by faruxx »

i used jvideo.com for my local videos
greghl
Posts: 2
Joined: Fri Aug 26, 2016 4:47 pm

Re: How Can I add Video on Knowledge base

Post by greghl »

The solution provided here is only a partial solution - because once submitted cleanup is done within the 'admin/manage_knowledgebase.php' file - and no amount of tinkering with the javascript function tinyMCE.init was seemingly able to let me save a kb article with an embedded video.

The knowledge base article is 'cleaned' using the HTMLpurifier library with default settings:

Code: Select all

        // Clean the HTML code
        require(HESK_PATH . 'inc/htmlpurifier/HTMLPurifier.standalone.php');
        $purifier = new HTMLPurifier();
        $content = $purifier->purify($content);
This has the effect of removing your iframe and it took me quite a while late last night to work out that this was the problem, not the original tinyMCE issue.

So - my fix was to alter 'admin/manage_knowledgebase.php' to allow iframe embeds of videos, but only from vimeo + youtube - my code is now:

Code: Select all

        // Clean the HTML code
        require(HESK_PATH . 'inc/htmlpurifier/HTMLPurifier.standalone.php');
        $config = HTMLPurifier_Config::createDefault();
//allow iframes from trusted sources
        $config->set('HTML.SafeIframe', true);
        $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo
        $purifier = new HTMLPurifier($config);
        $content = $purifier->purify($content);
Voila - I can now save KB articles with youtube/vimeo videos. My hint came from a lot of searching and the solution eventually 'clicked' after reading section 4.3 of the HTMLPurifier installation guide:

http://htmlpurifier.org/live/INSTALL

I hope this helps - and would encourage the Hesk developer teams to incorporate limited embeds within the next release, and possibly upgrading tinyMCE to the latest version with a customizable editor for admins to set different editors for our staff members.
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Re: How Can I add Video on Knowledge base

Post by Klemen »

This used to work before 2.6.8 when HTMLPurifier was implemented.

Thanks for sharing your solution. The video embedding will indeed be supported back in 2.7.0 using a custom filter (to also allow properties such as allowfullscreen).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
greghl
Posts: 2
Joined: Fri Aug 26, 2016 4:47 pm

Re: How Can I add Video on Knowledge base

Post by greghl »

Thank you for the info Klemen!
Post Reply