views:

260

answers:

2

I'm building a site with Joomla where a forum should exist amongst other things. But also I plan to develop a custom made functionality (diary-like) with a php inserts (it really works, for example with jumi). The problem is that I suppose nobody will understand if the forum and this sub-site will have separated logins. I'd use an existing forum authentication for my code also, but I don't like the idea that the login will look like forum-only login. I see there are bridges exist (like JFusion), but should I choose one particular forum extension if I plan to use a particular bridge extension? And are bridges easy to access with custom-made php code?

+1  A: 

If this is for a Joomla 1.5 website, you will want to create a user plugin that will log the user into your custom site as they log into Joomla. Take a look at plugins/user/example.php for an example user plugin. The onLoginUser function will be called just after someone successfully logs into Joomla. At this point, you'll have all of their data in the $user array that's passed into the function. You should be able to use this information to create a bridge into your external PHP application.

jlleblanc
Can this login be used for any of existing forum extensions?
Maksee
The existing forum extensions *should* be using this login information, yes.
jlleblanc
A: 

Hi, i'm using an authentication plugin that use the event onAuthenticate to login the user into his google apps account. Now i want to use the credential given by the user to get a client using Zend Gdata Framework to interact with google Apps. I made a user plugin that get the client at the event onLoginUser and store the client into a joomla session variable. The problem is that my plugin semms to be invisible to joomla and it's not executed. Please help me! Here's the code:

    defined('_JEXEC') or die( 'Restricted access' );

    jimport('joomla.plugin.plugin');

    set_include_path(JPATH_SITE.PATH_SEPARATOR.get_include_path());

    require_once 'plugins/user/joomla.php';
    require_once 'Zend/Loader.php';

    Zend_Loader::loadClass('Zend_Http_Client');
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

    class startGAppClient extends plgUserJoomla{


     function onLoginUser($user, $options = array())
     {
      parent::onLoginUser($user, $options);
      $userid = $user['fullname'];
      $userpass = $user['password'];
      $client = new Zend_Gdata_ClientLogin;

      $gonapps_domain = split("\n",$this->params->get( 'gonapps_domain' ));

      foreach ($gonapps_domain as $domain)
      {
       $domain = str_replace("@","",$domain);
       if(strlen($userid) && strlen($userpass))
       {
        $client->getHttpClient($userid, $userpass);
        if(!empty($client)){
         $session->set('google_client', $client);
         $success == 1;
        }
       } 
       if ( $success == 1 ) { break; }
      }
      $check = "check OK";   
      $session->set('check', $check);

      return true;
     }
  }
Marco