Page 1 of 1

User Registration Error

Posted: Mon Nov 26, 2007 11:51 am
by Kiran cheema
Hi I am getting the following error when people try and register through the Register me :

Catchable fatal error: Object of class stdClass could not be converted to string in C:\xampp\htdocs\Joomla\libraries\joomla\document\html\renderer\message.php on line 70

I have had a look at the file and I cant understand why i'ts causing this.
I have set the authentication to automatic ( i.e. no account activation required)
The registration works that is if they go back to the home page and try and loging they can but it keeps displaying the above on initial registration?
The error is linked to this statement - line 70 is the bit in red?
if (count($msgs)) {
  $contents .= "\n".JText::_( $type )."";
  $contents .= "\n";
  $contents .= "\n\t";
  foreach ($msgs as $msg)
{
  $contents .="\n\t\t".$msg."";
}
  $contents .= "\n\t";
  $contents .= "\n";

Re: User Registration Error

Posted: Mon Nov 26, 2007 6:46 pm
by taloch
Hi,

I get exactly the same error message, but mostly a blank registration form comes up.

I get the correct message after I press the go button on the address bar in the browser.

"Welcome!
Welcome to the Registered User content of our site"

How do you write "press the go button on the address bar" in the code? Cause that will cure it!!

http://localhost/joomla153/index.php?option=com_user
is in the address bar when I press the go button on the address bar.

I also tried the   in my template index.php.
It didn't work, just got that error message.

Where in the index.php should that go? Anywhere special? I am using a RT Firenzie template BTW.


Regards, taloch

Re: User Registration Error

Posted: Wed Nov 28, 2007 9:09 pm
by taloch
I have installed the Community Builder extension, and I am using the Community Builder Login Module.

It works perfectly with none of the above problems.

So this is a good work around for this error in j! 1.5

Regards, taloch

Re: User Registration Error

Posted: Fri Nov 30, 2007 4:42 pm
by ianmac
Kiran cheema wrote: Hi I am getting the following error when people try and register through the Register me :

Catchable fatal error: Object of class stdClass could not be converted to string in C:\xampp\htdocs\Joomla\libraries\joomla\document\html\renderer\message.php on line 70

I have had a look at the file and I cant understand why i'ts causing this.
I have set the authentication to automatic ( i.e. no account activation required)
The registration works that is if they go back to the home page and try and loging they can but it keeps displaying the above on initial registration?
The error is linked to this statement - line 70 is the bit in red?
if (count($msgs)) {
  $contents .= "\n".JText::_( $type )."";
  $contents .= "\n";
  $contents .= "\n\t";
  foreach ($msgs as $msg)
{
  $contents .="\n\t\t".$msg."";
}
  $contents .= "\n\t";
  $contents .= "\n";
Can you add a line after line 52:
print_r( $msg['message'] );

And let us know what error you get?  I can't duplicate this here, and I suspect that something is getting an JException object instead of a string for a message.

Ian

Re: User Registration Error

Posted: Fri Nov 30, 2007 4:57 pm
by Kiran cheema
sure I'll give it a go..
I'm pretty new to PHP but I've done some digging and I think that it may have something to do with the
components/com_user/Controller.php File

I have been trying to follow the process through and I think that it may be the function Register_save that is causing the problem.

I was looking through the file and there is a bit at the end of this function this function uses $message instead of $msg as the others do.
If I change everything but "JError::raiseNotice('', $message);" to $msg then it displays a blank registration page, instead of the error.

// Everything went fine, set relevant message depending upon user activation state and display message
if ( $useractivation == 1 ) {
// Page Title
$document->setTitle( JText::_( 'REG_COMPLETE_ACTIVATE_TITLE' ) );
// Breadcrumb
$pathway->addItem( JText::_( 'REG_COMPLETE_ACTIVATE_TITLE' ));

$message->title = JText::_( 'REG_COMPLETE_ACTIVATE_TITLE' );
$message->text = JText::_( 'REG_COMPLETE_ACTIVATE' );
} else {
// Page Title
$document->setTitle( JText::_( 'REG_COMPLETE_TITLE' ) );
// Breadcrumb
$pathway->addItem( JText::_( 'REG_COMPLETE_TITLE' ));

$message->title = JText::_( 'REG_COMPLETE_TITLE' );
$message->text = JText::_( 'REG_COMPLETE' );
}
//TODO :: this needs to be replace by raiseMessage
JError::raiseNotice('', $message);

$this->register();
}

However I have downloaded the latest nightly build and have also noticed that there is a newer version of this file so was planning to swap it out and see if it makes a difference.

Re: User Registration Error

Posted: Tue Dec 04, 2007 9:54 am
by Kiran cheema
Hi
Just to say I did as ian said in his post and it started displaying a 403 error, I have since swapped out the components/Com_user/controller.php file with the one from the nightly build and this has fixed the error, registration is now followed by a "you many now log on" message

I am planning addin community builder as well (as suggested by taloch), but it feels good to have got it working!

Re: User Registration Error

Posted: Tue Dec 04, 2007 2:42 pm
by taloch
Thanks for the fix, it is working fine here now.

;D

Re: User Registration Error

Posted: Thu Dec 13, 2007 4:25 pm
by gnottage
The existing fix only works for registration not requiring activation. Also it displays a registration form when the user has just registered (which could be confusing). I'm not sure how to get some changes into SVN for this, but the following are what I have done since previous fixed version) to allow for working registration with activation and not having the form displayed again:

components/Com_user/controller.php

function activate()
{
...

// Lets activate this user
jimport('joomla.user.helper');
if (JUserHelper::activateUser($activation))
{
$message  = JText::_( 'REG_ACTIVATE_COMPLETE' );
}
else
{
$message  = JText::_( 'REG_ACTIVATE_NOT_FOUND' );
}

//TODO :: this needs to be replace by raiseMessage
JError::raiseNotice('', $message);

// If the registration form should be displayed then uncomment this
// $this->register();

}

I would also advise commenting out the registration form in the function called register_save.