Skip to content

Instantly share code, notes, and snippets.

@dmuth
Created August 24, 2010 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmuth/546688 to your computer and use it in GitHub Desktop.
Save dmuth/546688 to your computer and use it in GitHub Desktop.
<?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