Solved Wrong values of fields fields and redirect to Joomla profile

  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
1 maand 1 week geleden - 1 maand 1 week geleden #3429 door Dmitrijs Rekuns
Hi Ruud,

I've noticed two strange behaviours.
1. There is a menu item to "Edit Profile" page (OchSubscriptions). 
Non-SEF for better understanding: option=com_users&view=profile&layout=edit&Itemid=175 
When I click on Save button, the page is being redirected to default Joomla profile page.
Non-SEF URL: ?option=com_users&view=profile&user_id=590&Itemid=217
Why so? Isn't there a special view in OchSubscriptions?

2. I change any data in profile, click on save and... there are 2 problems:
- Empty fields (like Address 2 or VAT - NO) display as Website default (wrong value).
- No changes. E.g. I rename city or ZIP code and when go to Joomla profile page, there are no changes.

See:
 - I changed  the city to Limassol and ZIP code to 3506
- on the 2nd screenshot we see old values (city: Kransodar and ZIP: 350020)

Joomla cache disabled.

Joomla 6.0.4, OchSubscriptions - the latest version

Best regards,
Eugene

 
Laatst bewerkt 1 maand 1 week geleden doorDmitrijs Rekuns.
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
1 maand 1 week geleden #3430 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
Screenshots:
 
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
1 maand 1 week geleden #3431 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
OMG, I am terrible sorry!
?option=com_users&view=profile&layout=edit&Itemid=275

this is basically Joomla URL! Now it's clear which way to go.
I will investigate settings more attentively.

The topic can be closed.
Regards,
Eugene
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
1 maand 1 week geleden #3432 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
Oh, I was too quick.

Now I see there are no views of the component for the profile and then there are no other ways expect using com_users. So, the questions are actual.
Discussie gesloten.
Lees meer
1 maand 1 week geleden #3433 door Ruud van Lent
Beantwoord door Ruud van Lent in topic Wrong values of fields fields and redirect to Joomla profile
Hi Eugene,

ochSubscriptions doesn't have a front-end customer view, it is integrated with com_users (as you already noticed). This is done via the system plugin that adds via the Joomla API the billing / customer fields onto the (joomla) user fields. Saving, displaying, etc. is done by Joomla core.

I just tried to reproduce this but when I change billing field values (like zip code, country, vatnumber, etc.) these changes get stored correct on my sites. So I cannot reproduce.

at 10:00 this morning I will be releasing ochSubscription 3.5.1 (with which i am testing this), there is a change in script.js addressing changing the country field on the front-end (so in com_users / edit). Can you update to that version and then retry? I don't think it is related, but then we are looking at the same code base.

let me know how this goes.

regards,
Ruud.
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
2 weken 5 dagen geleden - 2 weken 5 dagen geleden #3454 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
Hi Ruud,
Eugene is here.

Well, I made an override for html/com_users/profile/default_custom.php and skip some groups (User Actions for super admin and user profile fields = ID 4) and skip empty fields to avoid Website default value.

Here is the code just in case if somebody needs it:
Code:
use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; /** @var \Joomla\Component\Users\Site\View\Profile\HtmlView $this */ $fieldsets = $this->form->getFieldsets(); if (isset($fieldsets['core'])) {     unset($fieldsets['core']); } if (isset($fieldsets['params'])) {     unset($fieldsets['params']); } foreach ($fieldsets as $key => $fieldset) {     $label = isset($fieldset->label) ? Text::_($fieldset->label) : '';     if (         $key === 'user_action_logs'         || $key === 'actionlogs'         || $label === 'User Actions Log Options'         || $label === Text::_('PLG_ACTIONLOG_JOOMLA_FIELDSET_LABEL')     ) {         unset($fieldsets[$key]);     } } $tmp          = $this->data->jcfields ?? ; $customFields = ; foreach ($tmp as $customField) {     $customFields[$customField->name] = $customField; } unset($tmp); ?> <?php foreach ($fieldsets as $group => $fieldset) : ?>     <?php      $fields = $this->form->getFieldset($group);      if (count($fields)) :         // Filter out fields that belong to group with id = 4         $fields = array_filter($fields, function($field) use ($customFields) {             return !(isset($customFields[$field->fieldname]) && (int) $customFields[$field->fieldname]->group_id === 4);         });         if (count($fields)) :     ?>         <fieldset id="users-profile-custom-<?php echo $group; ?>" class="uk-fieldset com-users-profile__custom users-profile-custom-<?php echo $group; ?>">                          <?php if (isset($fieldset->label) && ($legend = trim(Text::_($fieldset->label))) !== '') : ?>                 <legend class="uk-legend"><?php echo $legend; ?></legend>             <?php endif; ?>             <?php if (isset($fieldset->description) && trim($fieldset->description)) : ?>                 <p><?php echo $this->escape(Text::_($fieldset->description)); ?></p>             <?php endif; ?>             <ul class="uk-list uk-list-divider">                 <?php foreach ($fields as $field) : ?>                     <?php                     // Skip Subform completely if it belongs to group 4                     if (                         $field->type === 'Subform'                         && isset($customFields[$field->fieldname])                         && (int) $customFields[$field->fieldname]->group_id === 4                     ) {                         continue;                     }                     // Skip hidden fields and spacers                     if ($field->hidden || $field->type === 'Spacer') {                         continue;                     }                     // Get rendered field value                     if (array_key_exists($field->fieldname, $customFields)) {                         $fieldValue = $customFields[$field->fieldname]->value ?? '';                     } elseif (HTMLHelper::isRegistered('users.' . $field->id)) {                         $fieldValue = HTMLHelper::_('users.' . $field->id, $field->value);                     } elseif (HTMLHelper::isRegistered('users.' . $field->fieldname)) {                         $fieldValue = HTMLHelper::_('users.' . $field->fieldname, $field->value);                     } elseif (HTMLHelper::isRegistered('users.' . $field->type)) {                         $fieldValue = HTMLHelper::_('users.' . $field->type, $field->value);                     } else {                         $fieldValue = HTMLHelper::_('users.value', $field->value);                     }                     $cleanValue = trim(strip_tags((string) $fieldValue));                     // Skip empty values and extension default placeholders                     if (                         $cleanValue === ''                         || strtolower($cleanValue) === 'website default'                         || $cleanValue === Text::_('COM_USERS_PROFILE_VALUE_NOT_FOUND')                     ) {                         continue;                     }                     ?>                     <li>                         <div class="uk-child-width-expand uk-grid-small" uk-grid>                             <div class="uk-width-medium uk-text-break">                                           <div class="uk-text-bold">                                     <?php echo $field->title; ?>                                 </div>                             </div>                             <div>                                 <div>                                     <?php echo $fieldValue; ?>                                 </div>                                                    </div>                         </div>                     </li>                 <?php endforeach; ?>             </ul>         </fieldset>     <?php          endif;      endif;      ?> <?php endforeach; ?>
Laatst bewerkt 2 weken 5 dagen geleden doorRuud van Lent. Reden: code styling
De volgende gebruiker (s) zei dank u: Ruud van Lent
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
2 weken 5 dagen geleden #3455 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
How it was with the original file:
 

how it looks like now:
 

If VAT is not selected, then the system displays two-letter country code. Hm, maybe it's better to hide it too (what  do you think?), but right now it's ok for me.
Discussie gesloten.
Lees meer
2 weken 5 dagen geleden - 2 weken 5 dagen geleden #3456 door Ruud van Lent
Beantwoord door Ruud van Lent in topic Wrong values of fields fields and redirect to Joomla profile
Hi Eugene,

as said before; on none of my sites I can reproduce this 'website default' value. Could this be template related?
Do you also see that when using Cassiopeia as template (just as a test).
As you see here (address 2), the 'default' values are just empty:
 

and the business information is toggled to be hidden via script.js so that the VAT number displays when you toggle the register as business to no is not correct.
 
Laatst bewerkt 2 weken 5 dagen geleden doorRuud van Lent.
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
2 weken 5 dagen geleden - 2 weken 5 dagen geleden #3457 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
Hi Ruud,
Thanks for the answer.

OchSubs 5.3.1 is inside. Joomla 6.1.0.
See the result is the same with Cassi:
 
 
Laatst bewerkt 2 weken 5 dagen geleden doorDmitrijs Rekuns.
Discussie gesloten.
  • Dmitrijs Rekuns
  • Onderwerp Auteur
  • Offline
Lees meer
2 weken 5 dagen geleden #3458 door Dmitrijs Rekuns
Beantwoord door Dmitrijs Rekuns in topic Wrong values of fields fields and redirect to Joomla profile
Ruud,
you have mentioned script.js to be included on pages.
Btw, I do not see script.js in the HTML source code of the page...

Eugene
Discussie gesloten.