? Pending

User tests: Successful: Unsuccessful:

avatar rbsl-manisha
rbsl-manisha
4 Jan 2017

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.ph‌​p on line 307

Testing Instructions

Fatal error: Call to a member function setFieldAttribute() on boolean in /.../public_html/components/com_users/models/registration.ph‌​p 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

avatar rbsl-manisha rbsl-manisha - open - 4 Jan 2017
avatar rbsl-manisha rbsl-manisha - change - 4 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jan 2017
Category Front End com_users
avatar rbsl-manisha rbsl-manisha - change - 4 Jan 2017
The description was changed
avatar rbsl-manisha rbsl-manisha - edited - 4 Jan 2017
avatar rbsl-manisha rbsl-manisha - change - 4 Jan 2017
Title
Fix fatel error in normal registration process. #13471
Fix fatel error in normal registration process.
avatar rbsl-manisha rbsl-manisha - edited - 4 Jan 2017
avatar zero-24 zero-24 - change - 4 Jan 2017
Labels Added: ?
avatar RonakParmar
RonakParmar - comment - 5 Jan 2017

I have setup multi language site (English and Hindi).

  • Enabled Registration
  • Created Registration form menu item
  • Done registration using this menu item and worked fine.
    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.
avatar rbsl-manisha
rbsl-manisha - comment - 5 Jan 2017

@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 comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13472.
avatar joomdonation
joomdonation - comment - 5 Jan 2017

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.

avatar RonakParmar
RonakParmar - comment - 5 Jan 2017

So, It means, I have to install third party extension and need to use its registration process, correct?

avatar joomdonation
joomdonation - comment - 5 Jan 2017

Yes, if you want to re-procedure this issue (I could not re-procedure the issue with Joomla core users registration, too).

avatar RonakParmar
RonakParmar - comment - 5 Jan 2017

Suggest any free extension which allows me to do registration in joomla, So I can test this PR.

avatar joomdonation
joomdonation - comment - 5 Jan 2017

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:

  1. Joomla use JPATH_COMPONENT to locate the find the xml file which define the form

https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/form.php#L205-L208

  1. When the code is called from third party extensions, JPATH_COMPONENT points to the third party extension folder (for example components/com_osmembership) instead of components/com_users as expected in this case. So after this line is called https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/registration.php#L301, $form variable is empty/false

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.

avatar RonakParmar
RonakParmar - comment - 5 Jan 2017

Yes got it, thanks for the explanation.

avatar RonakParmar
RonakParmar - comment - 5 Jan 2017

I have tested this item successfully on f2cbca7

Done code review.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13472.

avatar RonakParmar RonakParmar - test_item - 5 Jan 2017 - Tested successfully
avatar joomdonation
joomdonation - comment - 5 Jan 2017

I have tested this item successfully on f2cbca7

I was able to re-procedure the issue with my own extensions. This PR fixed it.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13472.

avatar joomdonation joomdonation - test_item - 5 Jan 2017 - Tested successfully
avatar Bakual Bakual - change - 5 Jan 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-05 07:44:40
Closed_By Bakual
avatar Bakual Bakual - close - 5 Jan 2017
avatar Bakual Bakual - merge - 5 Jan 2017

Add a Comment

Login with GitHub to post a comment