MyBB Community Forums

Full Version: Image in the postbit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.  I am trying to add a custom image to the postbit.
Here is a screenshot of my current postbit:
http://i.imgur.com/YTeE3W4.png
Where I put a red box is where I want to be able to set a custom image for certain users.  Specifically I want it to be a badge that says "Donator" that I can give to certain people.  


What would be the best way to go about accomplishing this?

Thanks!
you can use template conditionals plugin and add required custom image with an if condition in the postbit templates

<if $post['usergroup'] == X then>custom image</if>
You will need the Template Conditionals for this purpose.
For the default theme the relevant part of the postbit template could be like:


<div class="post_author">
	<div class="author_statistics">
		{$post['user_details']}
	</div>
	{$post['useravatar']}
	<div class="author_information">
		<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
		<span class="smalltext">
			{$post['usertitle']}<br />
			{$post['userstars']}
			{$post['groupimage']}
		</span>
	</div>
    <if $post['usergroup'] == x then>
		<div>
		    <img src="image url"/>
	    </div>
    </if>
</div>

where x is the usergroup number that gets this extra image.

EDIT
It's the old song again, .m. is before me Smile

EDIT 2
Corrected condition in template (==)
Thanks a lot to you both, I'll let you know how it goes.

<div class="author_information">
			<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
			<span class="smalltext">
				{$post['userstars']}
				{$post['groupimage']}
			</span>
	</div>
	<if $post['usergroup'] = 4 then>
        <div>
            <img src="http://i.imgur.com/Ga9ljcE.png"/>
        </div>
    </if>
	<div class="author_statistics">
		{$post['user_details']}
	</div>

This is what I have now in .postbit but nothing seems to be showing up, and I am in group 4. :/

edit: Strange, when I take out the <if> statement and just the <div> it shows up, but the only group I'm in is group 4 (admins) and that's the most important part.



On an unrelated note, if you wouldn't mind taking a look at: http://ggvend.com/showthread.php?tid=2&pid=4#pid4
I'm not keeping that "donators" image, I found it online and am just testing the css out with it.

Does anything know how I can center that image vertically, though? I made it its own class, and have padding setup to move it over to the right a bit from the author_information, but I'm not sure how to center vertically. I tried setting position:relative and using top:50% but it didn't change. Any ideas? I'm not great with css!
looks like an equal to sign is missing in the code (== is required)
Quote:<if $post['usergroup'] == 4 then>
in general, image can be aligned by using correct padding / margin values
Thank you for that, can't believe I missed the sign..

But as for vertically centering, I've tried all kinds of different padding/margins but it doesn't want to move.
(08-09-2015, 08:13 AM)katz Wrote: [ -> ]I'm not great with css!

Welcome to the club!! Wink

Try this, the result is sometimes unpredictable in my eyes, but most times it works:

<img src="image url" style="vertical-align: -zzpx;"/>

where zz is a number in pixels (negative is displacing it to below).
edit: delayed response

well, you can try using position: relative; top: 25px; style properties for that div container