MyBB Community Forums
Border color for a user avatar based on its gender - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Border color for a user avatar based on its gender (/thread-187258.html)



Border color for a user avatar based on its gender - Eldenroot - 2015-12-19

Hello, is there any way how to change color of the border around the profile avatar of user according to its gender? 

I use conditional plugin, and it works for me with images shown in postbit... but I wanna replace this image with border color of its avatar.

Thank you very much!

What about to use overlay? one image as a background and on this image put <div> element. Is there anyone who can help me with this css solution? I tried it according to http://stackoverflow.com/questions/18339549/floating-div-over-an-image but without success Sad


RE: Border color for a user avatar based on its gender - SvePu - 2015-12-19

Hey...please try this:

Open theme template "postbit_avatar" and replace:
<div class="author_avatar"><a href="{$post['profilelink_plain']}"><img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} /></a></div>

with:
<div class="author_avatar"><a href="{$post['profilelink_plain']}"><img <if $post['fidX'] then>class="{$post['fidX']}_border"</if> src="{$useravatar['image']}" alt="" {$useravatar['width_height']} /></a></div>
Replace X in $post['fidX'] with the number of gender profile field. (default: 3)

Also add to theme global.css something like this:
.post .post_author div.author_avatar img.Male_border{
 border-color: blue;
}
.post .post_author div.author_avatar img.Female_border{
 border-color: pink;
}
.post .post_author div.author_avatar img.Undisclosed_border{
 border-color: gray;
}
.post .post_author div.author_avatar img.Other_border{
 border-color: green;
}



RE: Border color for a user avatar based on its gender - Eldenroot - 2015-12-20

@SvePu - thank you very much for your reply and help. Unfortunately my webhost forced update to php7 so Template conditionals plugin is not working anymore Sad I am really disappointed and I am looking for a new version. I hope it will be out soon.

@SvePu - I tried it in my local host - works great, I just need to changed CSS to something like this:

.post .post_author div.author_avatar img.Male_border{
border: 2px solid #ccc;
}

Thank you very much!