News:

Why not join! Get you away from Social Media!

Main Menu

YouTube Video Card

Started by Deaks, Nov 17, 2026, 03:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Deaks

YouTube Video Card - v1.0.2
Enhanced YouTube Embeds for SMF Forums
By BoredSkull


Overview

Transform standard YouTube embeds into detailed, interactive video cards without changing how members post videos.

YouTube Video Card enhances SMF's existing
[youtube]VIDEO_ID[/youtube] BBCode by displaying additional information alongside the video player.

✓ Uses SMF hooks. No theme edits required!

The modification integrates with SMF's existing functionality, making installation straightforward and allowing it to work without manually modifying theme templates.



Features

  • YouTube Player - Displays the embedded video directly within forum posts.
  • Video Information - Shows the video title, channel name, publication date, view count and likes.
  • Expandable Description - Includes the video's description, initially collapsed with a convenient "Show more" option.
  • Top Comments - Displays comments from the YouTube video beneath the player.
  • Existing Posts Supported - Automatically enhances previously posted YouTube videos without requiring members to edit their posts.
  • No Theme Modifications - Uses SMF hooks rather than requiring manual edits to theme files.
  • API Caching - Reduces unnecessary requests to YouTube through configurable caching.
  • Privacy-Conscious Embedding - Uses youtube-nocookie.com for video embeds.



How It Works

Members can continue using the existing YouTube button or posting YouTube links as normal.

The standard BBCode remains:

[youtube]VIDEO_ID[/youtube]
The modification automatically changes how the video is displayed when the post is viewed.

There is no need to change existing posts, introduce new BBCode or modify the editor.

Existing YouTube embeds are also upgraded automatically.

If an older post continues to show the original player, clear the SMF cache:

Admin → Configuration → Server Settings → Cache → Empty the cache



Installation

Installation is handled through the standard SMF Package Manager.

  • Download the modification package.
  • Navigate to Admin → Packages → Download Packages.
  • Select Upload Package and upload the downloaded file.
  • Click Install Now and follow the installation instructions.

No manual theme edits are necessary. The modification uses SMF hooks for integration.



YouTube API Configuration

To display additional video information, including descriptions and comments, a YouTube Data API v3 key is required.

Setting up your API key:

  • Visit Google Cloud Console.
  • Create a new project or select an existing project.
  • Enable YouTube Data API v3 for that project.
  • Navigate to APIs & Services → Credentials and create an API key.
  • Restrict the API key to YouTube Data API v3. Where appropriate, restrict access to your server's IP address.
  • Open your SMF administration panel and navigate to Admin → Configuration → Modification Settings → YouTube Video Card.
  • Enter your API key and save your settings.

Important: An API key is optional for basic functionality. Without one, the modification can still display the YouTube player and video title, but API-dependent features will be unavailable.



API Usage and Caching

YouTube Data API v3 provides a default free quota of 10,000 units per day.

The modification is designed to minimise API requests.

  • Approximately 2 API units are used per video data retrieval under the normal request pattern.
  • Video information is cached to prevent repeated unnecessary requests.
  • The default cache duration is 6 hours.
  • Cached information is reused instead of requesting fresh data on every page view.

This helps keep API usage manageable, including on forums with frequently viewed YouTube content.



Security and Privacy

Several considerations have been included in the implementation:

  • Server-side API Key - The YouTube API key remains on the forum server and is not exposed directly to visitors.
  • Forum-side Requests - Visitors' browsers retrieve card data through the forum rather than making direct YouTube Data API requests.
  • Comment Handling - YouTube comments are displayed as plain text.
  • External Links - Links within video descriptions use
    rel="nofollow ugc".
  • Privacy-Enhanced Embeds - Videos use the
    youtube-nocookie.com embedding domain.

Note regarding Referrer Policy:

YouTube requires browsers to send a suitable Referer header for embedded playback.

Avoid setting a forum-wide
Referrer-Policy: no-referrer policy, as this can interfere with YouTube playback.



Uninstallation

The modification can be removed through SMF's Package Manager.

During uninstallation, administrators are offered the option to remove the modification's stored settings and cache table.

This provides flexibility for administrators who may wish to reinstall the modification later.



Summary

YouTube Video Card brings a richer YouTube viewing experience to SMF forums while keeping the familiar posting process unchanged.

With expandable descriptions, video statistics, comments, caching and hook-based integration, it adds functionality without requiring manual theme modifications.

Easy Installation • No Theme Edits • Existing BBCode Supported

AWAITING APPROVAL - https://custom.simplemachines.org/index.php?mod=4520
  • 0 reactions

    Members who reacted


Deaks

Mod has been updated to 1.0.2 as a small bug was found in testing.
  • 0 reactions

    Members who reacted


Old Mellow

I think that I've found an error. I tried testing to see if boards could be restricted for guests. Then I saw this error:

Quotehttps://smf218.skhilled.com/index.php?action=admin;area=manageboards;sa=board2
/home/skhilled/public_html/smf218.skhilled.com/Sources/ManageBoards.php (Line 624)
Backtrace information

Type of error: Undefined
Error message Select
2: Undefined array key "boardid"

EDIT: I'm not sure if it is a SMF or a mod error...
  • 0 reactions

    Members who reacted


Deaks

not sure that is to do with the mod as it doesnt touch ManageBoards nor does it use boardid
  • 0 reactions

    Members who reacted


Old Mellow

Sorry, the backtrace info is:

#0: smf_error_handler()
Called from /home/skhilled/public_html/smf218.skhilled.com/Sources/ManageBoards.php on line 624
#1: EditBoard2()
Called from /home/skhilled/public_html/smf218.skhilled.com/Sources/Subs.php on line 6066
#2: call_helper()
Called from /home/skhilled/public_html/smf218.skhilled.com/Sources/ManageBoards.php on line 71
#3: ManageBoards()
Called from /home/skhilled/public_html/smf218.skhilled.com/Sources/Admin.php on line 499
#4: AdminMain()
Called from /home/skhilled/public_html/smf218.skhilled.com/index.php on line 191
  • 0 reactions

    Members who reacted


Deaks

none of them are used within this mod :/
  • 0 reactions

    Members who reacted


Old Mellow

Maybe it was a server glitch because I tried it again but didn't get the error.  :P
  • 0 reactions

    Members who reacted


Deaks

as it uses hooks it make no edits to any file :P
  • 0 reactions

    Members who reacted


Old Mellow

I was just looking at it on my cell and was thinking that maybe users could open/close the comments via an up/down switch? On a cell the comments can be very long, especially, on smaller cells.
  • 0 reactions

    Members who reacted


Deaks

remember in AP you can set how many comments from the cel to show :D
  • 0 reactions

    Members who reacted


Old Mellow

Yes, but that's for everyone. People like me don't always view the comments while others do. It would give users flexibility in how they would want to see them.
  • 0 reactions

    Members who reacted


Deaks

ill add to the roadmap :D
  • 👍 1

    Members who reacted


Old Mellow

I'm a former musician and DJ so I to there just for the music. Often times, I just set up a playlist and then go about doing other things. LOL

I have commented on some songs, though.
  • 0 reactions

    Members who reacted


Deaks

@Old Mellow your suggestion has been added into v1.1.0
  • 👍 1

    Members who reacted