When viewing user profile on frontend, "token reset" makes no sense
Reset is an ACTION therefore I would not expect to see it at all when viewing a profile details
Reset
Website default
Note that the token displayed here is actually different to the token when editing the user profile - see #29338
Labels |
Added:
?
|
As token reset is an action (in its own right), it should (imvho) not be "just another field" in the user profile, that if set to 1 when saving a profile, resets a token.
Resetting a token should be in a separate action to the saving of a profile.
"Reset token" is not a value that belongs in the entity (profile) of a user. Its transient. Its an command, an action, not a value that needs storing and regurgitating.
Removing it from the user entity would fix the rendering issue - by not showing it at all.
I disagree with you because then the user token management would have to take place entirely in JavaScript and AJAX.
The thing is, you could conceivably put a Reset button in the profile edit. The reset button can't submit the form so it'd have to go through an AJAX request. OK, so now you reset the token. Can you see the change? No, you need to reload the new token i.e. return it in the response of the AJAX call. But how do you display it other than targeting the edit field through JS code? Well, frontend and backend can have different IDs and field names. Also when the profile is edited through a 3PD extension. So now we're getting to the point where the solution becomes stupidly complicated.
Instead of that we have a boolean switch Reset. Its value is NEVER saved to the database which is what you're confused about and something you wouldn't be had you actually read the code or participated in the original discussion. Read the code and see how it works. It IS transient.
I dont need to read the code or or have participated in the original discussion to know that when viewing a user profile, seeing
Reset
Website default
is probably unhelpful, and meaningless. That is why I opened this issue.
The "Reset" label is only needed on the Edit Form because there it describes the toggle switch.
"Website default" is meaningless as, as you rightly say, the value is not stored and anyway is a bool and not a default.
Im not confused at all.
You actually agreed with that you would love to be able to hide stuff like this in your own extensions.
I am not doubting there are reasons why it was done the way it was, and if you were in involved then I have even less concerns.
I know its transient, all the more reason why the above text has no reason being on the page when viewing a profile.
The "How" a token is reset was not the discussion that this issue was raised to address. I added my opinion on a different way and you disagree with that - Im cool with that :) but that's a tangent to the actual raised issue.
That is why I opened this issue.
Phil, we don't disagree on principle :) I am not attacking you. I am trying to figure out with you how to resolve this issue.
I know its transient, all the more reason why the above text has no reason being on the page when viewing a profile.
I am glad that we agree that the field is transient. Your previous message made me believe that we were not on the same page. Apparently it was just a misunderstanding. All good.
The "How" a token is reset was not the discussion that this issue was raised to address. I added my opinion on a different way and you disagree with that - Im cool with that :) but that's a tangent to the actual raised issue.
I only explained how the token is reset to explain why this is implemented as a field instead of a button. It's not like I didn't think about it to begin with.
"Website default" is meaningless as, as you rightly say, the value is not stored and anyway is a bool and not a default.
I fully, 100% agree with that statement.
You actually agreed with that you would love to be able to hide stuff like this in your own extensions.
Yes, I do. SocialLogin and LoginGuard abuse the Joomla XML forms implementation in user plugins to render their own interface. However, they look horrid in the profile display page. I'd like to address that. If we find a good way to do it for this plugin I'd of course use the same approach in these plugins.
Maybe it is possible that we could do that through the code already present in the onContentPrepareForm
? Since you already have a good idea of what the problem is could you be so kind as to give it a shot and come up with a PR? I can provide the one of two necessary tests.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-06-07 11:53:14 |
Closed_By | ⇒ | Quy |
If you know of a way to hide a user profile field from the profile display please share it! I could use it for my own extensions as well. As far as I can tell Joomla doesn't give you an attribute to say "hide this from the profile but not when editing the profile". As far as I can tell, you can only return a custom value for display but not completely remove the field.