User tests: Successful: Unsuccessful:
Pull Request for Issue.
Summary of Changes
Fatal error: Call to a member function setFieldAttribute() on boolean in /.../public_html/components/com_users/models/registration.php on line 307
Testing Instructions
Fatal error: Call to a member function setFieldAttribute() on boolean in /.../public_html/components/com_users/models/registration.php on line 307
To check this issue
1.Set multi language site.
2. Try to register through normal registration module (with joomla registration is working fine)
ie. Easyprofile etc.
Documentation Changes Required
No
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_users |
Title |
|
Labels |
Added:
?
|
@RonakParmar ,This issue is coming after upgrading to Joomla 3.6.5. There is no issue with Joomla registration.
This issue is coming with other registration methods like Payplans Registration integration.
You can see the code that if form is not set the it should be checked before below mentioned code.
if (JLanguageMultilang::isEnabled())
{
$form->setFieldAttribute('language', 'type', 'frontend_language', 'params');
}
This issue happens with third party extensions (including my extensions) use register method of UsersModelRegistration to create a Joomla user accounts when registration is handled in our extension, not via Joomla core users registration. Here is the code which I use in my extension:
require_once JPATH_ROOT . '/components/com_users/models/registration.php';
$model = new UsersModelRegistration();
$model->register($data);
That code works well until Joomla 3.6.5. For now, I have to add some additional commands to my extension code to get it works:
if (JLanguageMultilang::isEnabled())
{
JForm::addFormPath(JPATH_ROOT . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_ROOT . '/components/com_users/models/fields');
}
If this PR is accepted, I can remove that code in the future, so +1 to get it merged.
So, It means, I have to install third party extension and need to use its registration process, correct?
Yes, if you want to re-procedure this issue (I could not re-procedure the issue with Joomla core users registration, too).
Suggest any free extension which allows me to do registration in joomla, So I can test this PR.
Sorry, I don't know any free extensions use that code to suggest. This honestly, can be merged base on code review if maintainers decide to accept it:
https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/form.php#L205-L208
Then the next line is called https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/registration.php#L306 , it throws fatal error.
This issue only happens with some third party extensions on a multilingual website. And third party extensions can fix it by adding some lines of code I mentioned in my previous comment.
Yes got it, thanks for the explanation.
I have tested this item
Done code review.
I have tested this item
I was able to re-procedure the issue with my own extensions. This PR fixed it.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-01-05 07:44:40 |
Closed_By | ⇒ | Bakual |
I have setup multi language site (English and Hindi).
Not able to reproduce this issue, let me know If I have done anything wrong.
Joomla! Version : Joomla! 3.7.0-alpha2 dev [ Amani ] 20-December-2016 23:59 GMT
PHP Version : 5.6.29-1+deb.sury.org~precise+1
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13472.