News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

"No Avatar" Radio Button Always Displayed in Profile

Started by archiebald, June 05, 2012, 02:41:32 AM

Previous topic - Next topic

archiebald

Not sure if this should be reported as a Bug.

SMF 2.02

I run a private forum for about 400 members where the admins set the avatars for each member when we sign them up.

All the user avatar features are turned off, but on the member's profile page, one radio button always remains displayed for "No Avatar" and the value is "ON".

So, if a member changes another part of their profile, then clicks the "Change Profile" button, his avatar link that we have set is broken.

When all user avatar features are turned off, the "No Avatar" option should also be disabled.

Am I missing something or is it a bug?

NanoSector

Yeah, I agree. Let me move this to bug reports real quick.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

IchBin™

Since the only options are:
Select an avatar from the server   
Upload an avatar to the server   
Choose a remotely stored avatar

I guess we need to add a specific permission to allow avatars or not.
IchBin™        TinyPortal

emanuele

That what I was wondering me too...on the other hand which other way there is to allow someone to use an avatar apart from those three?
If you remove those three permissions the users will be de facto unable to select an avatar.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

That's what I was thinking: https://gist.github.com/536454077e3982723843
But at the moment I'm not sure if the 'enable' is taken in consideration when saving the form.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

archiebald

Quote from: emanuele on June 05, 2012, 12:33:41 PM
That what I was wondering me too...on the other hand which other way there is to allow someone to use an avatar apart from those three?
If you remove those three permissions the users will be de facto unable to select an avatar.

That is what I need and that is how it worked in previous 1.xx versions, I believe there was an admin permission setting for something like "allow users to select their own avatar".  If it was unchecked, then nothing regarding avatars would appear on the user's profile page.  This is how I had it set up before and never had an issue.  All user avatars were pre-set by the admins using company ID photos.

I guess something was changed in 2.xx but I only noticed this behavior recently because a member edited their date of birth and their avatar disappeared.

Just to clarify the scenario, this is in a forum used for global communication between company employees in various countries.  New members cannot create their own account - all sign-ups are made by the admins so that membership is strictly controlled to employees only and we assign them an avatar when we create the account.

emanuele

The thing changed from 1.x to 2.0 is the fact that in 2.0 there is the option to select "no avatar". ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

kirbyiwaki

Is there a fix for this? I reverted to let users choose, but I wish I could just change some code and keep it as is.

emanuele

What you can quickly do is, in Profile.template.php:
Code (find) Select
function template_profile_avatar_select()
{
global $context, $txt, $modSettings;

// Start with the upper menu
echo '

Code (replace with) Select
function template_profile_avatar_select()
{
global $context, $txt, $modSettings;

if (empty($context['member']['avatar']['allow_server_stored']) && empty($context['member']['avatar']['allow_external']) && empty($context['member']['avatar']['allow_upload']))
return;

// Start with the upper menu
echo '


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

archiebald

Emanuele,
That certainly fixes the problem.  Thank you.

Now we need your code to be included in the next update.

I really wish I understood code  :-\

Thanks again!!

Arantor

Actually there is still a scenario why it is required, which is why it was actually set up in the first place.

How do you deal with the case where a user has an avatar because they were previously allowed, but now does not have permission?

archiebald

Arantor,
Not sure if I understood that.

The problem (for me) was, if an admin denies all permissions to users to select or change their avatar, the user's profile page still carried the "no avatar" radio button set as default to the ON condition.  Therefore when the user changes something else in their profile such as birthday, then hits the save button, the "No Avatar" command is invoked.  This is clearly wrong.

To me, it is logical that if the admin sets up no possibility of avatar change, then that is how the profile page should work. i.e. no changes should happen.

It is fine for the "No Avatar" radio button to be present when there is another option, but when no other option exists then the logic breaks down.

In my case the admins preset the avatar of each user and want nothing to change.

If you have a situation where you want to remove a ueser's avatar then the admin can still do it manually.

emanuele

That's true for anything that needs a permission to be used/edited (e.g. custom title or the entire additional profile settings, but also polls and PMs).

BTW about that one in particular (apart from the fact that the "fix" is just a template workaround, that still allow to actually change the setting if you know what you want to do), have yet another permission for the avatar seems a bit overkill to me...

@archiebald the "problem" is that none of the three options is "do not allow the users to set their avatar", they are three separated permissions the allow or not specific ways to set an avatar.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Arantor

The default in SMF is for users to be able to have an avatar, and if some of them set an avatar before you remove their permission, you actually can't override it - which is one of the reasons why 'No avatar' was implemented in the first place.

QuoteTherefore when the user changes something else in their profile such as birthday, then hits the save button, the "No Avatar" command is invoked.  This is clearly wrong.

Correct, it is wrong. But the solution isn't to hide the button, it's to not set that to a default value in the first place.

archiebald

emanuele and Arantor,

I am not disagreeing with what you say.  My concern is that SMF1.xx had a simple allow / disallow rule that worked.

For my purpose SMF2.xx has become overly complicated and doesn't follow proper logic.  IMO the solution posted by emanuele is now perfect and works logically because if I turn off all avatar permissions in admin, then nothing shows on the user page at all.

If I turn on selected avatar permissions for a particular member group then emanuele's mod has no adverse effect.

Quote from: Arantor on June 26, 2012, 08:18:00 PM
Correct, it is wrong. But the solution isn't to hide the button, it's to not set that to a default value in the first place.

Arantor, I don't even want users to have the ability to turn off their avatar so for me having the "no avatar" button hidden is perfect.  Besides with emanuele's code mod, the admin can still change the user's avatar.

Arantor

QuoteI am not disagreeing with what you say.  My concern is that SMF1.xx had a simple allow / disallow rule that worked.

That's the point, it didn't work. That's why it was changed, quite late in 2.0.

QuoteArantor, I don't even want users to have the ability to turn off their avatar so for me having the "no avatar" button hidden is perfect.

Why not? If I decide that one day I don't want to have an avatar, why stop me? Why not leave me that choice? And just not remove it by default (unintentionally)


To clarify, there are two different behaviours being discussed, your specific case and the default - and neither is ideal.

In your specific case I can see why you might go down that road, but in general terms, having the no-avatar button be always displayed may well be appropriate, just not made default by default. Two different things brought about by one case, I'm just refuting that it should be applied to everyone (i.e. base SMF), because your setup is far from typical.

archiebald

I agree that my setup may be unusual but the logic is simple.  The admins should have the ability to disallow ANY avatar activity on a particular forum.  Whether they choose to implement it is up to them.

Currently, with the "No Avatar" button always being displayed even if the radio button in the user profile is set OFF by default, if someone accidentally clicks it, the result is the same, their avatar link is broken and they cannot reset it.  This is not user friendly or logical.

As such it is always going to be troublesome.  Another possible solution is either add another default choice, or convert it to a checkbox when only one item is displayed.  But that still leaves the question that if they later change their mind and really wanted ther avatar, how do they get it back?  Once again, it is not logical.

Hence, the simplest and most logical solution I can come up with is that the "No Avatar" button should only be displayed when at least one of the other avatar selection buttons is also visible.

Assuming my request is implemented in the base SMF template then, on the very rare occasion that an existing board "might" be changed to work with avatars changes disallowed, and a member who "might" have had an avatar, "might" wish to convert to having no avatar then they could contact the admins to have it deleted.  This is what you were saying in your previous post and I seriously doubt that this scenario would ever come up practically.


Arantor

QuoteI agree that my setup may be unusual but the logic is simple.  The admins should have the ability to disallow ANY avatar activity on a particular forum.  Whether they choose to implement it is up to them.

I'm not disputing that. I'm just pointing out that removing 'No avatar' can actually screw up the setup.

QuoteCurrently, with the "No Avatar" button always being displayed even if the radio button in the user profile is set OFF by default, if someone accidentally clicks it, the result is the same, their avatar link is broken and they cannot reset it.  This is not user friendly or logical.

Yes, we had noticed. And as I pointed out, the solution is not to remove 'No avatar', but to make it not the default - two very different things. It was introduced for a reason, and a reason that annoyed me quite a bit in 1.1.x since I was using that for years before I moved to 2.0.

QuoteAs such it is always going to be troublesome.  Another possible solution is either add another default choice, or convert it to a checkbox when only one item is displayed.

You know, you can have radio buttons without a default selected in the first place, this would be the correct solution here - no default preset.

QuoteBut that still leaves the question that if they later change their mind and really wanted ther avatar, how do they get it back?  Once again, it is not logical.

If they later change their mind, they're still screwed either way. How can a user simultaneously have an avatar and not have an avatar?

QuoteHence, the simplest and most logical solution I can come up with is that the "No Avatar" button should only be displayed when at least one of the other avatar selection buttons is also visible.

Odd, I could have sworn you were arguing for removing it entirely, just like it was in 1.1.x.

There is still a case where it is actually necessary to have - and that is for users who had an avatar before you enacted your no-avatar permissions. There should not be a way to remove it in that case.

Quote"might" wish to convert to having no avatar then they could contact the admins to have it deleted

As I understood the changes, that would essentially prevent that from happening, but it's been so long since I looked over 2.0's code having rewritten parts of it in the intervening time it's entirely possible I misinterpreted what the exact consequences of the change would be.

QuoteI seriously doubt that this scenario would ever come up practically.

Far more often than you'd actually think. That's one of the perks of having done support around here for a few years, you realise that what is 'unique' is far from it, and I can think of several cases where your scenario has turned up multiple times. In fact, it's the core reason why no-avatar was even introduced, to be able to get rid of avatars that people had put on before the admin decided not to have avatars.

archiebald

Quote from: Arantor on June 26, 2012, 10:03:16 PM
I'm not disputing that. I'm just pointing out that removing 'No avatar' can actually screw up the setup.
How??

QuoteYou know, you can have radio buttons without a default selected in the first place, this would be the correct solution here - no default preset.
I know that but once it has been operated, there is no way back.

QuoteOdd, I could have sworn you were arguing for removing it entirely, just like it was in 1.1.x.
No, what I am saying is that if there is an option to choose an avatar, of course the "no avatar" option is also necessary.  But, if the admins decide on a "no user avatar selection" policy, then it simply should not be there. 

QuoteThere is still a case where it is actually necessary to have - and that is for users who had an avatar before you enacted your no-avatar permissions. There should not be a way to remove it in that case.

As I understood the changes, that would essentially prevent that from happening, but it's been so long since I looked over 2.0's code having rewritten parts of it in the intervening time it's entirely possible I misinterpreted what the exact consequences of the change would be.

I think this might be a point of misunderstanding.  This morning I already added the 2 lines of code made by emanuele.  This is how it is working...

With all avatar permissions disallowed,

       
  • the "no avatar" radio button does not exist on the user profile.
  • when the user changes another profile item and saves their changes, the condition of the hidden"no avatar" button is ignored. (i.e. avatar link remains unbroken)
  • admin profile is unaffected, all avatar choices are available including the "no avatar" radio button
  • admin can change the user avatar from the user's profile page to any form of avatar including "no avatar". (at a later date as per the example you referred to - which I still think is going to be rare)
With any of the avatar permissions allowed for a membergroup,

       
  • the user can see both the allowed avatar option and the "no avatar" button.
  • default condition of radio buttons is with the stored avatar selected.
That is why I am saying it is a perfect solution.  It is only hiding the "no avatar" button when the admin applies "disallow" to all avatar choices.  Where any one of the avatar choices is allowed, then the "no avatar" button remains completely unaffected.

Arantor

QuoteBut, if the admins decide on a "no user avatar selection" policy, then it simply should not be there. 

Yes, but if the admins decide on a no user avatar selection policy, how do you remove them from users who already have them if there's no 'no avatar' option? That's the problem. That's why it was introduced!

Quoteadmin can change the user avatar from the user's profile page to any form of avatar including "no avatar". (at a later date as per the example you referred to - which I still think is going to be rare)

This is the part that bugs me. As I understood the mess that is the profile code (and it IS a mess), you wouldn't actually be able to select anything in that situation.

Advertisement: