The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Sep 10, 2012 11:41 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Sep 10, 2012 11:31 pm
Posts: 3
Hello,
I have a plugin which logs users in to joomla once an account is created. This part works fine.
I also have a component (JoomBri) which extends the typical Joomla registration with additional fields etc...

When the registration is complete you would be taken to the checkout page.

My problem is that the plugin seems to kick in before the entire registration process is complete. So the standard Joomla fields (Name email password...) are entered and submitted, then all the additional fields are entered but nothing gets passed to the database.

Anybody able to help me?

The code for the plugin is:
Code:
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.plugin.plugin');

class Autologin extends JPlugin
{
   //Constructeur
   function Autologin(&$subject, $config)
   {
      parent::__construct($subject, $config);
   }
   
   function onUserAfterSave($user, $isnew, $success, $msg)
   {
      // just startup
      global $app, $model;
      
      $app = &JFactory::getApplication();
      
      if($app->isSite() && $isnew)
      {
         # Login process
         $credentials = array(
            "username" => $user["username"],
            "password" => $user["password_clear"]
         );
         
         if(is_dir(JPATH_BASE . DS . "components" . DS . "com_comprofiler")) {
            $database = &JFactory::getDBO();
            $sql_sync = "INSERT IGNORE INTO #__comprofiler(id, user_id) SELECT id,id FROM #__users";
            $database->setQuery($sql_sync);
            $database->query();
         }
         
         $app->login($credentials);
         
         // You can use the "return" hidden input in your form template
         $return = $this->params->get('return_url', JRoute::_('index.php'));
         
         if($return != "") {
           $app->redirect($return);
         }
         else {
           $app->redirect(JRoute::_('index.php'));
         }
      }
   }
}


Kind Regards,
Dave


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 



Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group