vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - Google Adsense After first post (with scrolling option) (https://vborg.vbsupport.ru/showthread.php?t=270066)

xMrCanadax 09-10-2011 10:00 PM

Google Adsense After first post (with scrolling option)
 
1 Attachment(s)
How To Install
Step.1:
GoTo Styles & Templates>Search in Templates>your style then search for "postbit_legacy" without quotations.

at the very bottom before "{vb:raw template_hook.postbit_end}"
add :

Code:

<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
  Your Google Adsense code here
</li>
</vb:if>

Step 2: (centering and coloring your adsense)
GoTo Styles & Templates>Search in Templates>your style then search for additional.css and anywhere add :

Code:

.firstpost_advert_container {
    clear: both;
    display: block;
    float: left;
    margin-bottom: 12px;
    position: relative;
    width: 100%;
    border: 1px solid #E5E6F4;
}

.firstpost_advert {
    with: 100%;
    background: #F1F1FA;
    border: 1px solid #fff;
    min-height: 90px;
    margin: 0;
    padding: 7px;
    text-align: center;
    vertical-align: middle;
}

Step 3: (IF YOU WANT SCROLL ONLY)
Code:

<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert"><marquee>
  Your Google Adsense code here
</marquee></li>
</vb:if>

Only add this if you want your banner to scroll. This can be used for others things other then adsense also.

You are finished! you can see a Demo Here

Customize the CSS as you wish. Hope this helped.

To exempt usergroups :

To exempt usergroups just do this

Replace :
<vb:if condition="$post['isfirstshown']

With :
<vb:if condition="$post['isfirstshown'] AND !in_array($bbuserinfo[usergroupid], array(X,Y,A))">

X,Y,A Being Usergroup ID's

AttalaEA 09-11-2011 04:01 PM

Works perfect. Marked as installed, nominated, and rated 5 stars.
Thank you for this nice and clean modification. :)

xMrCanadax 09-11-2011 04:22 PM

Quote:

Originally Posted by AttalaEA (Post 2244617)
Works perfect. Marked as installed, nominated, and rated 5 stars.
Thank you for this nice and clean modification. :)

Thank you! anything you might need let me know!

p@ndu 09-12-2011 10:56 AM

works great thanks for the modification

xMrCanadax 09-12-2011 10:51 PM

Np! Enjoy it.

BlueCheri 09-13-2011 04:40 PM

Works fine, how to exempt usergroup?

fionix 09-26-2011 02:28 PM

Is that similar to what they have over at the DP forum, the AD pulls up right on the first post?

xMrCanadax 10-11-2011 05:31 AM

Quote:

Originally Posted by BlueCheri (Post 2245437)
Works fine, how to exempt usergroup?

Replace <vb:if condition="$post['isfirstshown'] with <vb:if condition="$post['isfirstshown'] AND !in_array($bbuserinfo[usergroupid], array(X,Y,A))">

X,Y,A being usergroup ID's

Quote:

Originally Posted by fionix (Post 2250217)
Is that similar to what they have over at the DP forum, the AD pulls up right on the first post?

yes it does :)

xMrCanadax 10-11-2011 05:33 AM

To exempt usergroups just do this

Replace :
<vb:if condition="$post['isfirstshown']

With :
<vb:if condition="$post['isfirstshown'] AND !in_array($bbuserinfo[usergroupid], array(X,Y,A))">

X,Y,A Being Usergroup ID's

shoppingtelly 10-15-2011 01:52 PM

Is it possible to use this under third post?

Many thanks

xMrCanadax 10-18-2011 06:43 PM

Quote:

Originally Posted by shoppingtelly (Post 2257475)
Is it possible to use this under third post?

Many thanks

yeah for sure, in a hurry to go to work right now will post the tutorial when I get home.

shoppingtelly 10-18-2011 07:36 PM

thank you, you're a star!

flipture 10-19-2011 02:17 AM

Mine is showing up on the right side of the first post. Any ideas why? Did I miss something?

Great addon, thanks!

COL NIL SATIS 10-19-2011 01:37 PM

This looks pretty sweet

xMrCanadax 10-19-2011 08:25 PM

Thank you guys, and flip, what vbulletin version are you running?

karel1985 10-20-2011 05:28 AM

I use it for showing the ads after each 3th post

<vb:if condition="(THIS_SCRIPT == showthread) AND (($post[postcount] % 3) == 0)">
<li class="firstpost_advert_container"><div class="firstpost_advert">

YOUR AD CODE

</li>
</vb:if>

amorosso 10-20-2011 08:35 PM

Awesome thank you very much

xMrCanadax 10-24-2011 01:28 AM

Thanks for the awesome feedback guys. need any other mods pm me details and I will try at it.

temsamane 11-22-2011 12:43 PM

Quote:

Originally Posted by karel1985 (Post 2259239)
I use it for showing the ads after each 3th post

<vb:if condition="(THIS_SCRIPT == showthread) AND (($post[postcount] % 3) == 0)">
<li class="firstpost_advert_container"><div class="firstpost_advert">

YOUR AD CODE

</li>
</vb:if>

i need an adsense after each 9th post of a page. so if you go the the second page, its still on the 9th post of the page etc.

goxy63 11-25-2011 03:01 AM

Works juts great, my only problem is that adsense is showing after second post

Probably it is cause I use mod "first post on every page"
https://vborg.vbsupport.ru/showthrea...=239282&page=9

Any ideas, for now I left it under second post but I would like it under first as it is better like that I think.
Maybe to put it above "first post" in my case, lol ? (how to do that)

Thanks

xMrCanadax 11-25-2011 03:37 AM

Quote:

Originally Posted by goxy63 (Post 2271633)
Works juts great, my only problem is that adsense is showing after second post

Probably it is cause I use mod "first post on every page"
https://vborg.vbsupport.ru/showthrea...=239282&page=9

Any ideas, for now I left it under second post but I would like it under first as it is better like that I think.
Maybe to put it above "first post" in my case, lol ? (how to do that)

Thanks

Try disabling your other mod, it should work then?

goxy63 11-25-2011 09:42 AM

Quote:

Originally Posted by xMrCanadax (Post 2271646)
Try disabling your other mod, it should work then?

Yes, after disabling mentioned mod its just as it should be, that is GREAT :)

But my users already got use to this option (first post on every page), even I did...its kinda natural to have first one.... specially on forums where you have 100-200... pages

Not a coder just dont know how to fix this :(


Thanks

datoneer 12-09-2011 11:31 AM

I cannot see adsense ad. I have vb 4.1.8. Where's the problem?

xMrCanadax 12-17-2011 06:20 AM

Can you show me what you see @datoneer?

BlueCheri 03-09-2012 11:42 AM

Working fine with upgrade.

G!

chrisngrod 03-17-2012 05:38 PM

I'm going to mark this as installed. I am pretty sure I used your post to help me configure my pages.

I really hate the sites where it looks like they had some postbot insert the ads btw.

This is the code I inserted in my forum just in case people want to do something similar.

Quote:


<!--begin ads after first post-->

<vb:if condition="$post[postcount] % $vboptions[maxposts] == 1">

<vb:if condition="is_member_of($bbuserinfo, 1)">

<li class="firstpost_advert_container">
<div class="firstpost_advert">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<center>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-1.6.2-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-ui-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/ebay_activeContent-min.js'></script>
<script charset="utf-8" type="text/javascript">
document.write('\x3Cscript type="text/javascript" charset="utf-8" src="http://adn.ebay.com/cb?programId=1&campId=5337045326&toolId=10026&cust omId=Thread&keyword=bad+esn&width=605&height=90&fo nt=4&textColor=000000&linkColor=373C6B&arrowColor= 8BBC01&color1=058A13&color2=FFFFFF&format=Html2&co ntentType=TEXT_AND_IMAGE&enableSearch=n&useeBayT=n &usePopularSearches=n&freeShipping=n&topRatedSelle r=n&itemsWithPayPal=n&descriptionSearch=n&showKwCa tLink=n&excludeCatId=&excludeKeyword=&catId=15032& disWithin=200&ctx=n&flashEnabled=' + isFlashEnabled + '&pageTitle=' + _epn__pageTitle + '&cachebuster=' + (Math.floor(Math.random() * 10000000 )) + '">\x3C/script>' );
</script>
</center>

<center>
<a href="/payments.php">Remove this advertisement</a>.
</center>

</div>
</li>


<vb:if condition="$adsshown[] = 2"></vb:if></vb:if><vb:if condition="is_member_of($bbuserinfo, 2)">

<li class="firstpost_advert_container">

<div class="firstpost_advert">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<br />


<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-1.6.2-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-ui-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/ebay_activeContent-min.js'></script>
<script charset="utf-8" type="text/javascript">
document.write('\x3Cscript type="text/javascript" charset="utf-8" src="http://adn.ebay.com/cb?programId=1&campId=5337045326&toolId=10026&cust omId=Thread&keyword=bad+esn&width=605&height=90&fo nt=4&textColor=000000&linkColor=373C6B&arrowColor= 8BBC01&color1=058A13&color2=FFFFFF&format=Html2&co ntentType=TEXT_AND_IMAGE&enableSearch=n&useeBayT=n &usePopularSearches=n&freeShipping=n&topRatedSelle r=n&itemsWithPayPal=n&descriptionSearch=n&showKwCa tLink=n&excludeCatId=&excludeKeyword=&catId=15032& disWithin=200&ctx=n&flashEnabled=' + isFlashEnabled + '&pageTitle=' + _epn__pageTitle + '&cachebuster=' + (Math.floor(Math.random() * 10000000 )) + '">\x3C/script>' );
</script>


</div>

<br />

<center>

<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-1.6.2-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/jquery-ui-min.js'></script>
<script type="text/javascript" src='http://adn.ebay.com/files/js/min/ebay_activeContent-min.js'></script>
<script charset="utf-8" type="text/javascript">
document.write('\x3Cscript type="text/javascript" charset="utf-8" src="http://adn.ebay.com/cb?programId=1&campId=5337045326&toolId=10026&cust omId=Thread&keyword=bad+esn&width=605&height=90&fo nt=4&textColor=000000&linkColor=373C6B&arrowColor= 8BBC01&color1=058A13&color2=FFFFFF&format=Html2&co ntentType=TEXT_AND_IMAGE&enableSearch=n&useeBayT=n &usePopularSearches=n&freeShipping=n&topRatedSelle r=n&itemsWithPayPal=n&descriptionSearch=n&showKwCa tLink=n&excludeCatId=&excludeKeyword=&catId=15032& disWithin=200&ctx=n&flashEnabled=' + isFlashEnabled + '&pageTitle=' + _epn__pageTitle + '&cachebuster=' + (Math.floor(Math.random() * 10000000 )) + '">\x3C/script>' );
</script>
</center>

<center>
<a href="/payments.php">Remove</a> this advertisement.
</center>

</li>

<vb:if condition="$adsshown[] = 12"></vb:if></vb:if><vb:if condition="is_member_of($bbuserinfo, 5, 6, 7, 10, 12, 15, 16, 17, 18, 19, 24)">

<vb:if condition="$bbuserinfo['field13'] == 'No'">

<vb:else />

<li class="firstpost_advert_container">

<div class="firstpost_advert">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-1026739116117253";
/* CricketUsers (300 x 250 In Thread Box Ad) */
google_ad_slot = "6476112708";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


</div>

</li>

</vb:if>

</vb:if>

</vb:if>

<!--end ads after first post-->


So after the first post it gives guests and registered members 3 ads. Two adsense and one eBay.

For supporting members, it gives them two adsense by default. If they go into their profile and turn off the in post ads (field13), it will remove them.

By turning ads back on for my supporting members be default, I have received no complaints, yet have increased my ad revenue.


Yes I used depreciated <center> tags. One day when I'm not lazy or this becomes a real issue, I'll put it all in a div.

g00gl3r 05-27-2012 03:16 PM

Hi,

I'm trying to get this to work and it just doesn't seem to do anything at all with the newer versions of vBulletin.

Any help?

g00gl3r 05-27-2012 03:19 PM

Quote:

Originally Posted by chrisngrod (Post 2310442)
I'm going to mark this as installed. I am pretty sure I used your post to help me configure my pages.

I really hate the sites where it looks like they had some postbot insert the ads btw.

This is the code I inserted in my forum just in case people want to do something similar.




So after the first post it gives guests and registered members 3 ads. Two adsense and one eBay.

For supporting members, it gives them two adsense by default. If they go into their profile and turn off the in post ads (field13), it will remove them.

By turning ads back on for my supporting members be default, I have received no complaints, yet have increased my ad revenue.


Yes I used depreciated <center> tags. One day when I'm not lazy or this becomes a real issue, I'll put it all in a div.

I tried to add this before the last line in postbit, and nothing shows at all.

What am I doing wrong?

Naijasite 06-03-2012 02:55 AM

thanks alot its working fine on my Forum http://www.naijafinder.com/forum.php


All times are GMT. The time now is 07:14 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01311 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete