• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 2.x Branch ‹ General Support (v2.x)
  • Change font size
  • FAQ
  • Register
  • Login

Joomla integration

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

Post a reply
6 posts • Page 1 of 1

Joomla integration

Postby vinset » Mon Jan 14, 2013 9:05 am

I'm trying to implement phpFreeChat in joomla!
Can you help me to integrate the Joomla login in phpFreeChat 2.0.5?
I have created a component to launch the chat and it works fine. Now I want to use this code to autologin the registered users:

Code: Select all
$user =& JFactory::getUser();
 
if (!$user->guest) {

return $user->username;

} else  {

return 'guest'.rand(1,1000); }
vinset
New member
 
Posts: 3
Joined: Mon Jan 14, 2013 8:51 am
Top

Re: Joomla integration

Postby phpfreechat » Mon Jan 14, 2013 9:22 pm

Have a look to the pfc.before.auth server hook in the doc:
http://www.phpfreechat.net/documentation/hooks.html
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Re: Joomla integration

Postby vinset » Mon Jan 14, 2013 11:48 pm

If I use this code in the config file it doesn't find the JFactory librarie!
vinset
New member
 
Posts: 3
Joined: Mon Jan 14, 2013 8:51 am
Top

Re: Joomla integration

Postby phpfreechat » Tue Jan 15, 2013 6:24 pm

Maybe try to include it ?
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Re: Joomla integration

Postby vinset » Wed Jan 16, 2013 12:34 pm

I used this code to integrate the joomla framework in external script

Code: Select all
$GLOBALS['pfc_hooks']['pfc.before.auth'][5] = function ($app, $req, $res) {
   return function () use ($app, $req, $res) {

define( '_JEXEC', 1 );
define( 'JPATH_BASE', "/home/tdvkdoph/public_html" );
define( 'DS', '/' );

include ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' );
$mainframe =& JFactory::getApplication('site');


$user =& JFactory::getUser();


if (!$user->guest) {

return $user->username;

} else  {

return 'guest'.rand(1,1000); }
   };
 };


It works fine in a stand alone test file but not in the config file!
vinset
New member
 
Posts: 3
Joined: Mon Jan 14, 2013 8:51 am
Top

Re: Joomla integration

Postby phpfreechat » Wed Jan 16, 2013 3:55 pm

Maybe a PHP include conflict between pfc code and joomla code.
So you should have a look to the phpbb3 login integration :
https://github.com/kerphi/phpfreechat/t ... hpbb3-auth

Thanks to this you can have a standalone script to access the joomla framework.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top


Post a reply
6 posts • Page 1 of 1

Return to General Support (v2.x)

Who is online

Users browsing this forum: No registered users and 1 guest

  • 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