• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Please help with phpBB3 integration

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

Post a reply
4 posts • Page 1 of 1

Please help with phpBB3 integration

Postby pastorvictor » Fri Feb 08, 2013 8:17 am

I feel like I'm very close to getting it to work. I already have it "embedded" on my forums and it already asks you to log in if you're not already; however, no matter who I log in as (I have my admin username and then another regular username) it logs me in as a guest with admin powers. I don't know what I'm doing wrong. Here's my code:

Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
 
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
 
if ($user->data['user_id'] == ANONYMOUS)
{
    login_box('', $user->lang['LOGIN']);
}

// Output page
page_header('Chat');

$template->set_filenames(array(
    'body' => 'chatroom_body.html',
));

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Chat de ForosCristianos.net";
$params["nick"] = $user->data['username_clean'];
$params['firstisadmin'] = false;
if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5 OR $user->data['group_id'] == 9) // Admins and Moderators
{
$params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate ;)
}

$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
//Make admins and moderators chatroom operators
if ($auth->acl_get('m_') || $auth->acl_get('a_'))
{
   $params["isadmin"] = true;
}
$chat = new phpFreeChat( $params );

// Send data to template
$template->assign_vars(array(
   'S_CHATROOM'   => $chat->printChat(true) . $warning)
);

page_footer();

?>


And here's the link to my chat: http://www.foroscristianos.net/chat/
If you'd like to log in, the tester username is "tester" and the password is "tester."

Any help will be greatly appreciated!
pastorvictor
New member
 
Posts: 2
Joined: Fri Feb 08, 2013 8:16 am
Top

Re: Please help with phpBB3 integration

Postby OldWolf » Fri Feb 08, 2013 7:33 pm

Worked fine for me? Logged me in as tester in the chat and I didn't have admin.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Re: Please help with phpBB3 integration

Postby pastorvictor » Sat Feb 09, 2013 10:16 am

Thank you for your fast reply, OldWolf.

However, I have decided to switch to SMF instead of phpBB. Unfortunately, I'm not being able to find a tutorial on how to integrate phpfreechat with SMF. Would you please let me know what I need to do, or point me in the direction of a current tutorial for this?

Thanks again.
pastorvictor
New member
 
Posts: 2
Joined: Fri Feb 08, 2013 8:16 am
Top

Re: Please help with phpBB3 integration

Postby OldWolf » Sat Feb 09, 2013 6:38 pm

pastorvictor wrote:Thank you for your fast reply, OldWolf.

However, I have decided to switch to SMF instead of phpBB. Unfortunately, I'm not being able to find a tutorial on how to integrate phpfreechat with SMF. Would you please let me know what I need to do, or point me in the direction of a current tutorial for this?

Thanks again.

The process to integrate the chat into anything is roughly the same. If you don't know how to do any of the steps, the forum for your software should be able to provide that (we don't know all software, just pfc):
Find out how to produce a blank page that includes all the necessary headers for getting usernames and so forth. Most forum softwares provide a link somewhere describing how to create a blank page within their software.

At the top of the page you get set up (make sure it works without doing anything to it), you'll want to add the PFC include, parameters, and creation of the PFC object:
Code: Select all
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Quick chat";
$params["nick"] = "guest".rand(1,1000);  // setup the intitial nickname
$params['firstisadmin'] = true;
//$params["isadmin"] = true; // makes everybody admin: do not use it on production servers ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
$chat = new phpFreeChat( $params );


Where you want the chat to actually display, somewhere in the body, place the print command:
Code: Select all
<?php $chat->printChat(); ?>

In this example, it's surrounded in php tags, incase you are working in an html body. If it's already in the middle of php tags, leave those off.

Now check that this is working correctly, and if you can't work out problems, post here.

Once that's functioning, you'll want to change your parameters. You can change them however you want, but based on your previous code, two things you'll want to do is find out how to get the username from your forum software, and how to get if they are admin or not. If you can't find this from a google search, I'd suggest just posting at their forum, someone should be able to answer that rather quickly.

Once you know that, you'll set the parameters similar to how you did with phpbb. I will use capital NICK in place of however you get the nickname from your software, and ISADMIN for however you get if they are admin from your software. ISADMIN should return true or false if they are an admin or not.
Code: Select all
$params = array();
$params["title"] = "Quick chat";
if(NICK == "guest")
     $params["nick"] = "guest".rand(1,1000);  // so that more than one guest can be in the chat at the same time
else
     $params["nick"] = NICK;
$params["isadmin"] = ISADMIN;
$params["serverid"] = md5(__FILE__);


And that should about do it. Let me know if you get stuck, but try google first, you'll get much quicker answers.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top


Post a reply
4 posts • Page 1 of 1

Return to phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)

Who is online

Users browsing this forum: No registered users and 3 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