Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* This code is to load a chat created with Drupal's Chat Room module
* (http://drupal.org/project/chatroom) into a block.
* If implemented properly, users will be able to chat from any page
* on the site that displays this block.
*
* @author Douglas Muth <http://www.dmuth.org/>
*/
//
// The node ID of the chat to load.
//
$nid = 1377;
$node = node_load($nid);
//
// Load the node.
//
$html = node_view($node, FALSE, TRUE, FALSE);
//
// Remove submitter info.
//
$regexp = "|<span class=\"submitted\">.*?</span>|";
$html = preg_replace($regexp, "", $html);
//
// Remove tag list
//
$regexp = "|<span class=\"taxonomy\">.*?</span>|s";
$html = preg_replace($regexp, "", $html);
//
// Remove the tagging form
//
$regexp = "|<form[^>]+id=\"community-tags-form(-1)?\">.*?</form>|s";
$html = preg_replace($regexp, "", $html);
print $html;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.