MyBB Hacks

Full Version: Avatar maximum dimensions set by usergroup problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've adapted some code taken from another thread (which for the love of God I cannot find), which sets the maximum dimensions of an avatar based on the usergroup GID called from an array.

The code works to resize the dimensions of the avatar, but the array is not working. The array should make usergroups like Administrators and Moderators have a larger avatar size, but it is skipping the code and going straight to the 'else' part. I can't seem to see the problem with my code, it just won't work at all!

The code is placed in the "postbit_avatar" template and replaces the default code.



Quote:<a href="{$post['profilelink_plain']}">
<img src="{$post['avatar']}" alt="" <if (in_array($mybb->user['usergroup'] , array('3','4','6','10','15'))) then>
style="max-width:150px; max-height: 200px"<else>
style="max-width:100px; max-height: 100px"</if>/>
</a>

If anyone can see what I'm doing wrong with my code, or has any suggestions for a potential workaround (plugins, edits to base php or templates) then I would be highly appreciative.
Change $mybb->user['usergroup'] to $post['usergroup']
The former refers to the logged in user, the latter refers to the post's user.
Reference URL's