Show related videos when playback ends

Permalink
I've added some YouTube videos to a customer site, but they don't want related videos to show at the end (many are competitors.) I see in the settings for the YouTube block this checkbox: "Show related videos when playback ends" Checking it appends rel=1 to the URL of the video, but with it unchecked, the rel=1 disappears instead of changing to rel=0. Without that rel=0 in the URL the related videos still show up. Is there a way to get that to show up in the URL?

walkingstick
 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
Hello,

All those settings are set in the view of the block so you can create a template for the youtube block by copying the file view.php and modifying it.

1- go to applications/blocks
2- create a folder named "youtube"
3- inside it create a folder called "templates"
4- inside it create a folder called something, all lowercase and underscore instead of spaces. For instance, you can name it "no_related_videos"
5- inside it put a copy of the files view.php and view.css that you can find in the original youtube block's folder in concrete/blocks/youtube
6- Modify the file view.php as follow:

Line 52 you will see
if (isset($rel) && $rel) {
    $params[] = 'rel=1';
}

Modify it to be
if (isset($rel) && $rel) {
    $params[] = 'rel=1';
} else {
    $params[] = 'rel=0';
}


Now you apply your template to your block and you're good to go
walkingstick replied on at Permalink Reply
walkingstick
This worked like a charm. The only difference was, the original Line 52 was this:
$params[] = 'rel=' . (isset($rel) && $rel ? '1' : '0');


I don't know PHP at all, but this looks like it was trying to take into account the need for rel=0
mnakalay replied on at Permalink Reply
mnakalay
I have to say I am very surprised. The line I copied is from Concrete5 5.8. The one you are showing me is from Concrete5 5.7.

What surprises me a great deal is the line you are showing should have worked, you shouldn't have had an issue in the first place.

The only reason I can think of is your Concrete5 was updated to v8 and the code ACTUALLY being used would then be in updates/concrete/blocks/youtube:view.php and would resemble the one I showed you at first.

If you don't have that file in the updates folder, I really have no logical explanation as to why you had that problem.