Solved Wrong values of fields fields and redirect to Joomla profile
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
1 month 1 week ago - 1 month 1 week ago #3429
by Dmitrijs Rekuns
Wrong values of fields fields and redirect to Joomla profile was created by 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
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
Last edit: 1 month 1 week ago by Dmitrijs Rekuns.
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
1 month 1 week ago #3430
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Wrong values of fields fields and redirect to Joomla profile
Screenshots:
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
1 month 1 week ago #3431
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on 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
?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
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
1 month 1 week ago #3432
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on 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.
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.
The topic has been locked.
- Ruud van Lent
-
- Offline
Less
More
- Posts: 1823
- Thank you received: 117
1 month 1 week ago #3433
by Ruud van Lent
Replied by Ruud van Lent on 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.
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.
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
2 weeks 5 days ago - 2 weeks 5 days ago #3454
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on 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:
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; ?>
Last edit: 2 weeks 5 days ago by Ruud van Lent. Reason: code styling
The following user(s) said Thank You: Ruud van Lent
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
2 weeks 5 days ago #3455
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Wrong values of fields fields and redirect to Joomla profile
The topic has been locked.
- Ruud van Lent
-
- Offline
Less
More
- Posts: 1823
- Thank you received: 117
2 weeks 5 days ago - 2 weeks 5 days ago #3456
by Ruud van Lent
Replied by Ruud van Lent on 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.
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.
Last edit: 2 weeks 5 days ago by Ruud van Lent.
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
2 weeks 5 days ago - 2 weeks 5 days ago #3457
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Wrong values of fields fields and redirect to Joomla profile
Last edit: 2 weeks 5 days ago by Dmitrijs Rekuns.
The topic has been locked.
- Dmitrijs Rekuns
-
Topic Author
- Offline
Less
More
- Posts: 158
- Thank you received: 8
2 weeks 5 days ago #3458
by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on 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
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
The topic has been locked.