Edit Profile Issues with Custom Fields

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #211409

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.2
-- PHP version -- : 5.6.3
-- Browser(s) name and version -- : Chrome 44.0.2403.155
-- Error-message(debug-mod must be tuned on) -- : Warning: array_values() expects parameter 1 to be array, null given in /Applications/AMPPS/www/plugins/user/profileGroup/profileGroup.php on line 208

Hi, please help on these issues regarding the custom fields for users.

On registration, it works perfectly fine. But not in the Edit Profile.




I have set conditional custom fields as follows:


if Occupation = others
- [none]

if Occupation = student
- school
- coursefacultystudent
- studentid
- studentpass

if Occupation = teacher
- school2
- coursefacultyteacher
- staffid
- staffpass

In the Edit Profile, the conditional are not in place and all fields are shown at the same time.
When I try to fill out only 1 set of fields, and submit, I get the error message shown.



Appreciate your help. Thanks!

Attachments:
Last edit: 9 years 3 months ago by sapura.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211433

Hi,

The warning comes from the "profileGroup" user plugin you're using. That's not a HikaShop plugin.

Regarding the fact that you see fields regardless of their "display limited to" setting, add the code:

$requiredFields = array();
		$validMessages = array();
		$values = array('user' => $user);
		$this->fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);
		$this->fieldsClass->addJS($requiredFields, $validMessages, array('user'));
after the code:
$fieldsClass->addJS($null,$null,$null);
		$fieldsClass->jsToggle($extraFields['user'],$user,0);
in the file plugins/system/hikashopuser/hikashopuser.php and that should fix that behavior.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #211488

Hi, Thanks for the reply.

There are however 2 locations of the code in hikashopuser.php

$fieldsClass->addJS($null,$null,$null);
		$fieldsClass->jsToggle($extraFields['user'],$user,0);

I have tried adding to both locations and I get this error when I tried to Edit the Profile Page

Fatal error: Call to a member function checkFieldsForJS() on null in /Applications/AMPPS/www/plugins/system/hikashopuser/hikashopuser.php on line 341


Line 341 after adding the code is referring to
$this->fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);

Once I removed the code from the 2nd place, the Edit Profile page is ok, but the fields are again not adhering to the 'display limited to' setting.

Appreciate your help.
Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211502

Hi,

Ah yes, use that code instead:

$requiredFields = array();
		$validMessages = array();
		$values = array('user' => $user);
		$fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);
		$fieldsClass->addJS($requiredFields, $validMessages, array('user'));

You can add it to both locations.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #211668

Hi, I've added to both locations this new code and it is still not working.
/index.php/your-profile/profile?layout=edit

Am I the only one who encounter this issue? :(

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211706

Hi,

Ok, also change the line:

$data .= '<div class="control-group"><div class="control-label"><label>'.$fieldsClass->getFieldName($oneExtraField).'</label></div><div class="controls">';
to:
$data .= '<div class="control-group hikashop_registration_' . $fieldName. '_line" id="hikashop_user_' . $fieldName. '"><div class="control-label"><label>'.$fieldsClass->getFieldName($oneExtraField).'</label></div><div class="controls">';
and that should work. It now does on my end with these modifications.

Everyone has the issue but you're the first one noticing it as most people don't need fields limited by other fields for the user profile.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #211763

Hi thanks but it is still showing all fields with the new code.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211788

Hi,

We don't have the problem anymore on our end.
Please provide a link to the page, a test account and a FTP access so that we can analyze the issue on your website.
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211957

Hi,

I was able to log on your website, but I couldn't access the Display>Custom fields area on your backend and you didn't provide a FTP access so I'm not able to debug the issue.
Could you also provide that please ?

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #212001

Hi, sorry about that. I have enabled access for the Custom Fields.
Also, you can use Components > extplorer to access the files.
Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #212226

Hi,

Sorry for the delay.
I'm now able to access the custom fields, but I'm not able to access extplorer.
When I click on the link in the components menu, I'm getting redirected back to the dashboard of the backend.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 3 months ago #212297

Hi, I've enabled access for extplorer. Please check again. Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #212347

Hi,

I've checked and I could see that you were missing some other patch we had before. I've added them all for you and it's now working.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 2 months ago #212372

Hi, thanks.

Yes I see the fields are now conditional.
However, if I select "Teacher", the dropdown for school has no options in it.

Also, Can you advise what are the patches you applied? I will need to apply this to the production server.
Thank you so much.


Attachments:
Last edit: 9 years 2 months ago by sapura.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 2 months ago #212443

Hi,

That's an issue with the chozen library. I don't know why it does that.
Try to add that CSS on your website:
#hikashop_user_school .chzn-container-single-nosearch{ width: auto !important; }

If that doesn't help, you can also turn off the "use chozen library" setting of the HikaShop configuration and that should circumvent the problem.

Regarding the patch, you can simply copy the file plugins/system/hikashopuser/hikashopuser.php to your other website in order to fix the issue.

Last edit: 9 years 2 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
9 years 2 months ago #212461

The chosen library was already turned off. And the CSS didn't work.

But I managed to get it working with
#school2_chzn { width:219px !important;}
Apparently something forces a width:0 on this div.

Thanks for your help in this. Really appreciated.
Cheers!

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum