Can we link country selector to replace the avatar with a flag instead.

Theyadora Leeper Posted in Component Development 4 years ago

I was thinking about using the users selected country to replace the avatar with a flag. maybe turn off the user avatar selection also. This base component could be very powerful and may be used as the basis for many many applications.
Can anyone lead me in the correct direction to do the link. I,e call and display the flag not the avatar.

Replies
us Theyadora Leeper Replied 4 years ago

thank you

German Michael Zülsdorff Replied 4 years ago

yep,
as the answer was my attempt at humour - trying to tell you i'm not feeling really motivated to spend one thought on this.
You can ask your members to upload a flag - and they might ignore it or upload any flag - fooling you
Or you can code an extra selector to upload a flag - and they might ignore it or select any flag - fooling you
That's why i don't see any advantage here.

Anyway, I simply google the web when i don't know how to get things accomplished - in this case jquery on select change and got https://stackoverflow.com/questions/12750307/jquery-select-change-event-get-selected-option

$('select').on('change', function (e) {
    var optionSelected = $("option:selected", this);
    var valueSelected = this.value;
    ....
});

So, all that's left to do is
- exchanging the too global 'select' by a unique id like '#my_flag_selector'
- adding the same selector to the $extra_field array as 'id' => 'my_flag_selector'
- completing the script with the upload part of the OssnProfile javascript, this time not based on a manually selected file but a filename derived from valueSelected

us Theyadora Leeper Replied 4 years ago

hmmm.. the battle was an attempt at humour. I was thinking more of an assigned avatar based on a users grade, for instance on a private school site.. I was using the country selector component as a basis for the edit. I was just asking for some community help in figuring out how to grab tha avatar based on a selector.

German Michael Zülsdorff Replied 4 years ago

To be honest,
I have no particular desire for such battles. I would simply ask my members to download a flag from Flagpedia.net. And done. ;)

https://flagpedia.net/index

us Theyadora Leeper Replied 4 years ago

ps, I know Roman or the Z~man could do this in a matter of minutes, let the battle begin ;)