Add Mibbit AJAX IRC client with nickname auto-completion

Last modified: July 13, 2008 - 15:47

This snippet is a quick way to add real-time chat to your drupal using the Mibbit AJAX IRC client from http://mibbit.com/widget.html

It has been tested on 5.7, but should work on any drupal version that stores user information in $user and sets $user-uid > 0 for logged-in users.

<?php
global $user;

// If the user is logged in, set IRC nickname to their username, else an anonymous one.

if($user->uid > 0) {
   
$nickname = check_plain($user->name);
} else {
   
$nickname = 'Agent%3F%3F%3F';
}

?>


<iframe width=695 height=500 scrolling=no style="border:0" src="http://embed.mibbit.com/?server=[your server spec]&channel=%23[your channel]&nick=<?php print "$nickname"; ?>"></iframe>

 
 

Drupal is a registered trademark of Dries Buytaert.