I could not make phpfreechat plugin to work, what I did was to make a regular folder at the root of my site called chat then put phpfreechat content there, then in my index.php put this code:
- Code: Select all
<?php
// this will integrate the wordpress database
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
require_once('../blog/wp-config.php');
$current_user = wp_get_current_user();
$user_name = addslashes($current_user->display_name);
$params = array();
$params["nick"] = "Guest".rand(1,1000);
if (!empty($user_name)) {
$params["nick"] = $user_name;}/*this make phpfreechat pickup the username from the wordpress cookie.*/
// other $params settings goes here
$chat = new phpFreeChat( $params );
//end of code
Then you call phpfreechat in a div, p, tag inside the index.php like this..
- Code: Select all
<div id="content">
<?php $chat->printChat(); ?>
</div>
Then now you have your wordpress integrated to your chat..... if user is not logged in will get a Random name, if logged in then get the wordpress user name from cookie...
Then you just need to play with css to make the chat look as you like.....
To make a Administrartor to any of your autors use this code...
- Code: Select all
$params["isadmin"] = false;
if ( current_user_can('publish_posts') ) $params['isadmin'] = true;
So there you have it, let me know if I omitted anything...
NOTE:
My root structure looks like this www is the root folder www/blog/ and www/chat/ where phpfreechat sits.... thats why the paths of wp-config.php migth be different that yours....