Camen Design Forum

Delete

(Leave this as-is, it’s a trap!)

To delete this post you must be either the original author or a designated moderator.
The content of the post will be removed but the name and date will remain.

  • The post will be removed completely from the thread, rather than blanked
  • Only posts on the last page of the thread can be removed completely (so as to not break permalinks)

RE[35]: embedd youtube videos?

dummy

Hi @Martijn

I already add this code to my theme.php but my forum still cannot embed youtube video.
Anything I need to alter / add ?

%
/* Put this in theme.php, inside the `theme_custom` function. */

	foreach ($template->query('.nnf_reply-author, #nnf_post-author') as $node) {
		// The file we want, md5 of the user name and the PNG extension:
		$filename = md5(trim($node->nodeValue)) . '.png';
		// The avatar directory on the server, I am assuming in the forum root:
		$avatardir = FORUM_ROOT . DIRECTORY_SEPARATOR . 'avatar' . DIRECTORY_SEPARATOR;
		// Test if the file exists in the directory:
		if (file_exists ($avatardir . $filename)) {
			$value = '<img src="/avatar/' . $filename . '" alt="" /> '
			       . $node->nodeValue;
			$node->nodeValue = '';
			$frag = $node->ownerDocument->createDocumentFragment();
			if (!@$frag->appendXML($value) || !@$node->appendChild($frag)) {
				throw new Exception("Invalid HTML");
			}
		}
	}
%

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn