• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Joomla, Drupal, and Wordpress (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Wordpress 2.9.2 integration phpfreechat 1.2 up to 1.3

Integration help for Joomla, Drupal, and Wordpress

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
5 posts • Page 1 of 1

Postby re*s.t.a.r.s.*2 » Fri May 28, 2010 1:49 am

Hi, this is for wordpress 2.9.2
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....
Last edited by re*s.t.a.r.s.*2 on Sun May 30, 2010 1:27 am, edited 1 time in total.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby bugger » Sat May 29, 2010 7:04 pm

Your code doesn't work... :(

I saw that it missed a "}" after "$params["nick"] = $user_name;" but now the chat doesn't load :/
I also replaced "require_once('../blog/wp-config.php');" to the correct path to my wp-config.php

There is my index.php (headers):
<?php
// this will integrate the wordpress database
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
require_once('../wp-config.php');
$current_user = wp_get_current_user();
$user_name = addslashes($current_user->display_name);
$params = array();
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$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 );
$params["title"] = "PowaServ Chat";
$params['firstisadmin'] = true;
//$params["isadmin"] = true; // makes everybody admin: do not use it on production servers ;)
$params["debug"] = false;
//end of code
?>

Thank you...
bugger
New member
 
Posts: 2
Joined: Fri Mar 17, 2006 9:06 pm
Top

Postby re*s.t.a.r.s.*2 » Sun May 30, 2010 1:43 am

You were right about missing } fix it now, your wordpress installation could sit differently in your server that's why the path of you wp-config.php is not the same as mine , now the thing that doesn't work in your code is because you missing this code at the end of the $params:

$chat = new phpFreeChat( $params );

fix that it should work now.... thank you
Last edited by re*s.t.a.r.s.*2 on Sun May 30, 2010 3:07 am, edited 1 time in total.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Joey77 » Thu Dec 09, 2010 11:02 am

Hi re*s.t.a.r.s.*2,

Can I use your code for my Wordpress site? I also want a phpfreechat plugin on my Wordpress. You made this code spending your time and effort in it, if you would permit me to use it then I would be very happy about it. :)
Last edited by Joey77 on Thu Dec 09, 2010 11:02 am, edited 1 time in total.
Shakeology Review | Shakeology Scam | Shakeology
Joey77
New member
 
Posts: 1
Joined: Thu Dec 09, 2010 10:53 am
  • Website
Top

Postby re*s.t.a.r.s.*2 » Thu Dec 09, 2010 3:37 pm

Every code people post here its free to use...
my friend don't worry about.. use it freely..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top


Post a reply
5 posts • Page 1 of 1

Return to Joomla, Drupal, and Wordpress (v1.x)

Who is online

Users browsing this forum: No registered users and 47 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub