{"id":268,"date":"2008-12-26T17:46:40","date_gmt":"2008-12-26T22:46:40","guid":{"rendered":"http:\/\/www.sherylcanter.com\/wordpress\/?p=268"},"modified":"2015-10-22T20:32:42","modified_gmt":"2015-10-23T01:32:42","slug":"integrate-flashchat-in-drupal-5-or-drupal-6","status":"publish","type":"post","link":"https:\/\/sherylcanter.com\/wordpress\/2008\/12\/integrate-flashchat-in-drupal-5-or-drupal-6\/","title":{"rendered":"Integrate FlashChat in Drupal 5 or Drupal 6"},"content":{"rendered":"<p><a href=\"http:\/\/www.tufat.com\/s_flash_chat_chatroom.htm\">FlashChat<\/a> is a mature, full-featured chat program that is free without source code, $5 with. It can be integrated nicely with Drupal, but it&#8217;s not easy to figure out how. Here&#8217;s how.<\/p>\n<p>The current version of FlashChat (5.0.10) contains a configuration file for Drupal integration (drupalCMS.php) that doesn&#8217;t work. So for starters, download the <a href=\"http:\/\/forum.tufat.com\/showthread.php?t=50869\">Drupal 5 &#038; 6 Integration Kit<\/a>.<\/p>\n<p>That solves many problems, but not quite all.<\/p>\n<p><!--more--><\/p>\n<h3>Installation<\/h3>\n<p>The integration kit contains a mostly-working drupalCMS.php script, and a &#8220;Who&#8217;s in chat&#8221; block module for Drupal 5 and Drupal 6. It takes just a few small tweaks to make these operational.<\/p>\n<p>The new drupalCMS.php needs no changes if your database host is something simple like &#8220;localhost&#8221;. But mine wasn&#8217;t &#8211; mine is &#8220;localhost:\/tmp\/mysql5.sock&#8221;, encoded in my Drupal settings.php file ($db_url variable) as &#8220;localhost%3a%2ftmp%2fmysql5.sock&#8221;. If your database host looks like mine, then you need to make one small change.<\/p>\n<p>In drupalCMS.php, search for:<\/p>\n<pre>\r\n      $parts[host]\r\n<\/pre>\n<p>and replace this with:<\/p>\n<pre>\r\n      rawurldecode($parts[host])\r\n<\/pre>\n<p><i>Edit 29-Dec-08: Veronica just fixed the host parameter code in her Drupal Kit.<\/i><\/p>\n<p>I encountered one more installation problem. This last problem is a bug in the general installation code, not the Drupal-specific code.<\/p>\n<p>When I got to Step 7 and tried to install FlashChat bots, I got a 500 Server Error. This turned out to be because the install program was setting permissions of 777 to the flashchat temp directory and all subdirectories. My Web host is running SuExec, so allowing the world write permissions will always generate a 500 Server Error.<\/p>\n<p>So when I got to Step 7 and the error, I used an FTP program to set the permission of temp and its subdirectories to 775 (no write permission for the world) and refreshed the page. That allowed it to load successfully and install the bots.<\/p>\n<h3>Displaying FlashChat within Drupal<\/h3>\n<p>When FlashChat is launched from within Drupal, it uses the Drupal users table and automatically logs in users who are logged into Drupal. So far, so good.<\/p>\n<p>But by default, it opens into its own browser window. You lose all your Drupal theming, blocks, headers, and footers. I didn&#8217;t like that.<\/p>\n<p>It&#8217;s very simple to make FlashChat display within a Drupal page. Just create a new page and enter this code:<\/p>\n<pre>\r\n      &lt;?php\r\n\r\n      echo '&lt;iframe width=\"100%\" height=\"450\" src=\"flashchat\/flashchat.php\"&gt;&lt;\/iframe&gt;';\r\n    \r\n      ?&gt;\r\n<\/pre>\n<p>Note that the source string shown here assumes that FlashChat is installed in a subdirectory under the Drupal root called &#8220;flashchat&#8221;. If you put it somewhere else, adjust the code.<\/p>\n<h3>Beware the Block Quirk<\/h3>\n<p>The FlashChat module for a &#8220;Who&#8217;s in chat&#8221; block works very nicely, but beware: <b>You must go into the Admin area for the FlashChat module and save settings <i>before<\/i> enabling the block, or an error will prevent you from accessing your site.<\/b> The FlashChat variables are not saved to the Drupal variables table until you go into the Admin area and save settings.<\/p>\n<p>If you&#8217;re reading this after already encountering this error, just launch phpMyAdmin and delete the flashchat entry from the blocks table. That will get Drupal running again.<\/p>\n<p>There are two things you should check when you are in the FlashChat Module Admin area:<\/p>\n<ul>\n<li>Make sure the name of the FlashChat directory is correct. The default is &#8220;chat&#8221;, but I called mine &#8220;flashchat&#8221;.<\/li>\n<li>You will want to remove the link to &#8220;Go to chat&#8221; if you want an embedded chat (or edit the code). The &#8220;Go to chat&#8221; link opens FlashChat in a separate window without the Drupal sidebars, header, and footer.<\/li>\n<\/ul>\n<p>To change the link so it opens to your embedded chat, find this line in flashchat.module (the line is wrapping here, but it&#8217;s one line in the file):<\/p>\n<pre>\r\n      if($chatLinkText) $chatLink = '&lt;a href=\"' . base_path() . $chat . \r\n          'flashchat.php\" target=\"_blank\" title=\"' . $chatLinkTitle . '\" alt=\"' . \r\n          $chatLinkTitle . '\"&gt;' . $chatLinkText . '&lt;\/a&gt;&lt;br&gt;';\r\n<\/pre>\n<p>Replace it with this:<\/p>\n<pre>\r\n      if ($chatLinkText) \r\n          $chatLink = '&lt;a href=\"' . base_path() . 'fchat\" title=\"' . $chatLinkTitle . \r\n          '\" alt=\"' . $chatLinkTitle . '\"&gt;' . $chatLinkText . '&lt;\/a;gt;&lt;br&gt;';\r\n<\/pre>\n<p>And then make sure that your Drupal page with the chat uses the url &#8220;fchat&#8221;. Don&#8217;t call it &#8220;flashchat&#8221; or it will launch FlashChat in a separate window (if your directory is called &#8220;flashchat&#8221;).<\/p>\n<h3>Configuring FlashChat<\/h3>\n<p>I find the default colors for FlashChat to be unreadable and headache-inducing, but happily this can be changed to match your Drupal theme. You can change many other aspects of the program from the adminstration area, as well:<\/p>\n<p>http:\/\/<i>yoursite.com<\/i>\/<i>chatdir<\/i>\/admin\/index.php<\/p>\n<p>There&#8217;s a bug in the sounds feature in FlashChat 5.0.10 &#8211; settings are ignored. If you&#8217;re desperate to mute the sounds, you can delete the \/flashchat\/sounds\/ folder.<\/p>\n<p>There are some things that are not figurable in FlashChat that should be, and new chatters can&#8217;t see ongoing discussions from before they joined the chat. If these problems bother you, take a look at the <a href=\"http:\/\/www.sherylcanter.com\/wordpress\/2008\/12\/phpfreechat-in-drupal\/\">phpFreeChat module for Drupal 5.x<\/a>.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>FlashChat is a mature, full-featured chat program that is free without source code, $5 with. It can be integrated nicely with Drupal, but it&#8217;s not easy to figure out how. Here&#8217;s how. The current version of FlashChat (5.0.10) contains a configuration file for Drupal integration (drupalCMS.php) that doesn&#8217;t work. So for starters, download the Drupal &hellip; <a href=\"https:\/\/sherylcanter.com\/wordpress\/2008\/12\/integrate-flashchat-in-drupal-5-or-drupal-6\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Integrate FlashChat in Drupal 5 or Drupal 6<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/posts\/268"}],"collection":[{"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":43,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":417,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/posts\/268\/revisions\/417"}],"wp:attachment":[{"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sherylcanter.com\/wordpress\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}