Jump to the post that solved this thread.
Solved: 6 Years, 1 Month, 2 Weeks ago [How To?] Image in the postbit
#1
Solved: 6 Years, 1 Month, 2 Weeks ago
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!
Reply
#2
Solved: 6 Years, 1 Month, 2 Weeks ago
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>
Reply
#3
Solved: 6 Years, 1 Month, 2 Weeks ago
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 (==)
Regards, Ad Bakker (NL)
Reply
#4
Solved: 6 Years, 1 Month, 2 Weeks ago
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!
Reply
#5
Solved: 6 Years, 1 Month, 2 Weeks ago
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
Reply
#6
Solved: 6 Years, 1 Month, 2 Weeks ago
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.
Reply
#7
Solved: 6 Years, 1 Month, 2 Weeks ago
(2015-08-09, 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).
Regards, Ad Bakker (NL)
Reply
#8
Solved: 6 Years, 1 Month, 2 Weeks ago
edit: delayed response

well, you can try using position: relative; top: 25px; style properties for that div container
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)