User Register Error on Joomla 3

If you search by error code: PHP Fatal error: Call to a member function where() on a non-object in /home/username/sitename/joomla/components/com_users/models/registration.php on line 521 and landed here, you are very closed to the solutions.

When a new user tried to register, he may received the 500 error. The real error information is behide it. So go to check the error.log file.

Then you will see the error infomation:

PHP Fatal error: Call to a member function where() on a non-object in /home/username/sitename/joomla/components/com_users/models/registration.php on line 521

It is a bug of Joomla 3.1.1. Two bracket typos.


To fix it, just modify the file: joomla/components/com_users/models/registration.php

Go to line 109, change the bracket as below.

$query->select($db->quoteName( array('name', 'email', 'sendEmail', 'id')))
->from($db->quoteName('#__users'))
->where( $db->quoteName('sendEmail') . ' = ' . 1);

Go to line 521, change the bracket as below/

$query->select($db->quoteName(array('name', 'email', 'sendEmail')))
->from($db->quoteName('#__users'))
->where($db->quoteName('sendEmail') . ' = ' . 1);

That is all.