PDA

View Full Version : Adsense block in first post for guests only


geckoz
04-17-2012, 03:29 PM
Hi there,

I am looking for a simple mod oder addon to put an AdSense block on the left or right side in the first post and have the text / content float left or right the adsense block. Only guests should be able to see this adsense block in the first post.

Can anybody help me?

Thanks so much!

BirdOPrey5
04-17-2012, 06:45 PM
You really don't need a mod for this.

vBulletin has a built in "Ad Location" template called ad_showthread_firstpost_start.

Simply go to your style manager, edit templates, and open that template.

Paste in your ad code from google directly into that template.

To make it visible only to guests add this template conditional:


<vb:if condition="$show['guest']">
all ad code here...
</vb:if>

geckoz
04-18-2012, 10:13 AM
Found it, but with this template I can not make the text float around the ad. I think it's because the "first post ad" template is displayed before the content of the first post.

Any suggestions?

BirdOPrey5
04-18-2012, 12:04 PM
That's weird, when I used it I remember the ad being off to the side.

Edit- Oh you mean float around the text...

Try putting the ad code inside this:


<vb:if condition="$show['guest']">
<div style="width:200px; float:right;">
all ad code here...
</div>
</vb:if>


set the width to the actual width of the ad...

If that doesn't work in your posbit/postbit_legacy template move this code:



<vb:if condition="$post['isfirstshown']">
{vb:raw ad_location.ad_showthread_firstpost_start}
{vb:raw ad_location.thread_first_post_content}
</vb:if>


Directly above:
{vb:raw post.message}

And try it again.

If that doesn't work simply hit the "Revert Template" button to revert the postbit back to normal. (Or if the template was already customized, just undo the changes above. DON'T REVERT in that case.)

g00gl3r
05-27-2012, 03:00 PM
Trying to get this to work and nothing seems to happen. Any clues as to why?

BirdOPrey5
05-27-2012, 06:57 PM
If "nothing" is working are you sure you're making changes to the right style? Add a line like "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" just to test and make sure your changes are showing up. (Then obviously undo it if it does show.)

g00gl3r
05-27-2012, 08:14 PM
Got it. I've done it via editing the postbit_legacy. I don't suppose you know the conditional to show only in the first post? Or maybe even first and second post, but the guests only?

BirdOPrey5
05-27-2012, 09:23 PM
<vb:if condition="$post['isfirstshown'] AND $show['guest']">
xxxx
</vb:if>


first post of every page for guests only.

There is no condition for 2nd post shown... you could use $post['postcount'] == 2 but it would only be the actual second post, not on every page of the thread.