MyBB Community Forums

Full Version: Add border to user's avatar based on their title
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! Can someone advise if there is a way to add custom colored borders to user's avatar based on their title? 
Let's say I have a member with 0 posts and their title is Newbie so their border is gray, another member with 50 posts called Active Poster - has a red border. I need to show those colored borders on index, postbit, and custom PHP pages. 

I have tried playing with template conditionals by creating a code something like 


<if $mybb->user['title'] != Newbie then> 
<img class="avatarborder" src="{$mybb->user['avatar']}" alt="">

<style>

.avatarborder { border: 5px solid #555; }

</style>


I am not sure if I am using the correct variables, but it doesn't seem like it's working? I specifically want to display different color borders based on user's titles by their posts/posted threads activity. Also, any advice would be appreciated.
(2021-05-01, 09:16 PM)Kieria Wrote: [ -> ]
<if $mybb->user['title'] != Newbie then> 
<img class="avatarborder" src="{$mybb->user['avatar']}" alt="">

<style>

.avatarborder { border: 5px solid #555; }

</style>

I know this post is old but this should work. However, it's going to depend on the template in use.

On member profiles usertitle is called as {$usertitle} but on posts its {$post['usertitle']}, so you will just need to use the proper form of the variable based on the template.

I would suggest wrapping 'Newbie' (or any other title) in order to work though.
<if $mybb->user['title'] != 'Newbie' then> 
<img class="avatarborder" src="{$mybb->user['avatar']}" alt="">

<style>

.avatarborder { border: 5px solid #555; }

</style>