vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=192)
-   -   Show Thread Enhancements - Adsense as second post. 2 Sizes - Big for guests, small for members (https://vborg.vbsupport.ru/showthread.php?t=136743)

StarBuG 01-16-2007 10:00 PM

Adsense as second post. 2 Sizes - Big for guests, small for members
 
Hi

I made this template mod for my medical Forum and I decided to share this with you

This hack is for forums that use the standard Postbit Template

If you use the postbit_legacy template >> click here <<

What this hack does:
This modification displays adsense as second post in every thread.
Guest see a post like adsense with a product Referral (firefox in this code) and a large rectangle as post content. Members only see a standard banner so they don't get annoyed by the big advertising. I also included an information for guests, that they see a different not so disturbing ad if they register. This serves to purposes, one is to get more members to register of course the second purpose is to blend the advertising better into the post layout.

ADD-ON:
In addition you can add a Google Adsense link unit as last post of a thread on any page for members and guests. This advertising will only show if the thread has more then one post so that it does not show 2 advertisings directly below each other in case that the thread has no replies yet. Google Adsense has updated its ToS so that you are now allowed to use up to three link units on one page. So if you already use my "Adsense Link Unit in Navbar" Mod there woun't be a problem.

See screenshots ;)

How to install:

In template postbit search:


Code:

<!-- / post $post[postid] popup menu -->
Add below:


Code:

<!-- Google AdSense in Posts for Guests -->
<if condition="THIS_SCRIPT == 'showthread' AND !$GLOBALS['FIRSTPOSTID'] AND (!$show[member])">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>   
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="currentPost">
  <div class="normal">
        <!-- status icon and date -->
        <img title="Alt" class="inlineimg" src="images/statusicon/post_old.gif" alt="Alt" border="0"></a> Today
        <!-- / status icon and date -->
    </div>
    </td>
</tr>
<tr>
    <td class="alt2" style="padding: 0px;">
        <!-- user info -->
        <table border="0" cellpadding="0" cellspacing="6" width="100%">
        <tbody>
        <tr>
      <td class="alt2">
      <!-- Adsense Referal Code start -->
        <script type="text/javascript"><!--
        google_ad_client = "YOUR PUB ID HERE";
        google_ad_width = 125;
        google_ad_height = 125;
        google_ad_format = "125x125_as_rimg";
        google_cpa_choice = "CAAQ0f2XhAIaCA6IC4oIlz0_KK2293M";
        //--></script>
        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
      <!-- Adsense Referal Code end-->

      </td>
            <td nowrap="nowrap">
      <span class="bigusername"><u>Advertising</u></span><br />
      <span class="smallfont">Google Adsense</span>
            </td>
            <td width="100%">&nbsp;</td>
            <td valign="top" nowrap="nowrap">
      <div class="smallfont">
        <div>This advertising will not be shown</div>
        <div>in this way to registered members.</div>
        <div><a href="register.php">Register</a> your free account today</div>
        <div>and become a member on</a></div>
        <div>$vboptions[bbtitle]</div>
      </div>
            </td>
        </tr>
        </tbody></table>
        <!-- / user info -->
    </td>
</tr>
<tr>
    <td class="alt1" id="td_post_$post[postid]">
    <!-- message, attachments, sig -->
            <!-- icon and title -->
            <div class="smallfont">
               
                <img title="Standard" class="inlineimg" src="images/icons/icon14.gif" alt="Standard" border="0">
                <strong>Sponsored Links</strong>
            </div>
            <hr style="color: rgb(134, 134, 134);" size="1">
            <!-- / icon and title -->
        <!-- message -->
        <div>
        <!-- Adsense large rectangle start -->
        <script type="text/javascript"><!--
        google_ad_client = "YOUR PUB ID HERE";
      google_ad_width = 336;
        google_ad_height = 280;
        google_ad_format = "336x280_as";
        google_ad_type = "text";
    //--></script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
        <!-- Adsense large rectangle end -->
        </div>
        <!-- / message -->
    <!-- message, attachments, sig -->
    </td>
</tr>
</tbody></table>
<!-- / post $post[postid] popup menu -->
</if>
<!-- / Google AdSense in Posts for Guests End-->

<!-- Google AdSense in Posts for Members -->
<if condition="THIS_SCRIPT == 'showthread' AND !$GLOBALS['FIRSTPOSTID'] AND ($show[member])">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>   
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="td_post_$post[postid]">
  <div class="normal">
        &nbsp;
    </div>
    </td>
</tr>
<tr>
    <td class="alt1" align="center">
        <div>
    <!-- Adsense standard banner start -->
      <script type="text/javascript"><!--
      google_ad_client = "YOUR PUB ID HERE";
      google_ad_width = 468;
      google_ad_height = 60;
      google_ad_format = "468x60_as";
      google_ad_type = "text";
      //--></script>
      <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
    <!-- Adsense standard banner End -->
        </div>
    </td>
</tr>
</tbody>
</table>
</if>
<!-- / Google AdSense in Posts for Members end-->

ADD-ON:


Add this code below the last line of my above code:


Code:

<!-- Google AdSense Link unit as last post for all -->
<if condition="THIS_SCRIPT == 'showthread' AND $post['islastshown'] and !$GLOBALS['vbulletin']->GPC['ajax'] AND $post[postcount]!=1">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>   
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="td_post_$post[postid]">
  <div class="normal">
        &nbsp;
    </div>
    </td>
</tr>
<tr>
    <td class="alt1" align="center">
        <div>
        <!-- Adsense Link Unit start -->
        <script type="text/javascript"><!--
        google_ad_client = "YOUR PUB ID HERE";
        google_alternate_color = "F5F5FF";
        google_ad_width = 728;
        google_ad_height = 15;
        google_ad_format = "728x15_0ads_al_s";
        google_color_border = "F5F5FF";
        google_color_bg = "F5F5FF";
        google_color_link = "000000";
        google_color_text = "000000";
        google_color_url = "000000";
        //-->
        </script>
        <script type="text/javascript"
          src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
        <!-- Adsense Link Unit end -->
        </div>
    </td>
</tr>
</tbody>
</table>
</if>
<!-- Google AdSense Link unit as last post for all -->

You now just need to customize the adsense code marked with:
<!-- Adsense Referal Code start -->
<!-- Adsense large rectangle start -->
<!-- Adsense standard banner start -->

Add-on:
<!-- Adsense Link Unit start -->

replace "YOUR PUB ID HERE" with your pub-ID and fit the colors of adsense to your color scheme


Demo: Elternfragen.net - Das Forum f?r Eltern mit (medizinischen) Fragen Just go into any thread.


I hope you like it and if you do, don't forget to mark es installed ;)


Changelog:
v1.15 - 2007/07/22: NO CHANGES, just removed my Pub-ID from the hack!
v1.15 - 2007/06/11: Add-on - Google Adsense Link unit as last post of every thread for guests and members.
v1.1 - 2007/05/06: Condition altered to show advertising as second post on every page, not just the first.

If you want more good placements for adsense then check out my newest mod:

Adsense Link Unit in Navbar

StarBuG

If you did not register for an Adsense account yet but you plan to, feel free to contact me. If you register via my referral I am willing to help you get the most out of your adsense placement by assisting you during the setup process and implementing the best adsense modifications. Just write me a Private message.

o0Hubba0o 01-21-2007 04:02 AM

Nevermind, had adblock extension on firefox on and it wasn't showing up lol, works great!

azn_romeo_4u 01-21-2007 07:26 PM

Awesome mod, but i got a question, how do I make it so that it only shows on the first page for everyone and not just admins? Because I'm seeing that it displays on everyone page for members, but not for admins. So i want to disable on every other page but for the first page.

Also for guests it should show on each page.

StarBuG 01-21-2007 07:39 PM

For guests it does show on every page.
I am a little confused right now why it does not show for admins on second page.
I totaly missed that because I block advertisings anyway on my browser.

I took the condition from some similar hack I found a longer time ago.

I realy have no clue but I think it has something to do with
$post[postid] == $GLOBALS['qrfirstpostid']

Sorry that I can't help you with that but maybe someone else has an Idea?

azn_romeo_4u 01-21-2007 07:54 PM

O_O yup can't wait for it.

tsptom 01-22-2007 02:11 AM

Just what I was looking for - thanks a lot! Is this OK with Google's TOS?

StarBuG 01-22-2007 06:01 AM

Yes it is.
The Ads are clearly marked as such and there is no "tricking the user" to click.

But if you want to be sure write them and ask google to review your placement if it confirms with their ToS.
That is always the safest way to go.

tsptom 01-22-2007 08:15 PM

Confirmed. :)

Per Google:

I can confirm that your current implementation is compliant with our policies and is a well optimized ad layout up for your forums.

Thanks again!

StarBuG 01-23-2007 04:11 AM

Your welcome ;)

letsjoy 01-26-2007 05:17 AM

thanks goin to install

kylek 01-26-2007 05:38 AM

Thank you, nice and easy to install.

jacki 01-29-2007 01:13 PM

Thank You, very Good :)

ShackMaster 01-30-2007 05:21 AM

Installed with modifications to fit postbit legacy.

You can check out how I did it here... http://www.hometheatershack.com/forums

StarBuG 01-30-2007 06:48 AM

My postbit_legacy Version looks like this:

http://www.patientenfragen.net/showt...1399&styleid=6

3dsoft 01-31-2007 08:27 AM

Is it also possible to hide adsense from certain usergroups? What is the difference between postbit & postbit_legacy?

thanks

StarBuG 01-31-2007 03:16 PM

In the if condition at the very beginning of my code add:

Code:

AND $bbuserinfo['usergroupid'] == 'X'
at the end, where X is the usergroup ID.

So that it looks like this:

Code:

<if condition="THIS_SCRIPT == 'showthread' AND  $post[postid] == $GLOBALS['qrfirstpostid'] AND (!$show[member]) AND $bbuserinfo['usergroupid'] == '1'">

postbit_legacy is the old version to display posts (from vB 2.x times).
The userinfos are on the left site not on the top like it is here.

StarBuG

3dsoft 01-31-2007 06:11 PM

Hi StarBuG,
thank you for answering that fast. It somehow does not work , yet. ;)
I would like adsense not to show up for moderators (usergroup: 7) & admins (6). You could also say that I only want registered users who belong to usergroup 2 should see adsense.

I have tried to add "AND $bbuserinfo['usergroupid'] == 'X'' at he begining of the code. But the beginning of your code is for guests, right? The problem is that I want logged in moderators & admins not to see adsense.

I also tried to use:
Code:

<if condition="THIS_SCRIPT == 'showthread' AND  $post[postid] == $GLOBALS['qrfirstpostid'] AND (!$show[member]) AND $bbuserinfo['usergroupid'] == '1'">
...within the second part, but either all logged in users see adsense or all logged in users don't see adsense!?

FSHD 02-01-2007 04:09 PM

This is really nice.

StarBuG 02-04-2007 06:51 AM

to exclude usergroups you need to add:
Code:

AND $bbuserinfo['usergroupid'] != 'X'


to include Usergroups:
Code:

AND $bbuserinfo['usergroupid'] == 'X'

you could also wrap my whole code from above inside this:
Code:

<if condition="is_member_of($bbuserinfo, X)">

</if>

and for the X put all the Usergroups you want to see the ADs, like 1,2,3,4,7,9,10 etc ;)

roger.kore 02-10-2007 12:50 PM

I think this modification doesn't work if you have this installed
https://vborg.vbsupport.ru/showthrea...hreadid=131544

Im using 3.6.4

insolentmuse 02-11-2007 06:44 AM

How should this be modified for Legacy? I'm using a skin that doesn't have the new postbit option :(

StarBuG 02-11-2007 10:37 AM

@roger.kore: I have not installed the hack you mentioned but from the quick look I see no reason why it should not work.

@insolentmuse: I have published the postbit_legacy Version here: https://vborg.vbsupport.ru/showthread.php?t=139093

StarBuG

jeffcoll 02-11-2007 03:06 PM

Exactly what I wanted and so easy to install. It took just a couple of minutes.

I like how it encourages visitors to join and avoid the advertising.

insolentmuse 02-11-2007 04:13 PM

Quote:

Originally Posted by StarBuG (Post 1179801)
@roger.kore: I have not installed the hack you mentioned but from the quick look I see no reason why it should not work.

@insolentmuse: I have published the postbit_legacy Version here: https://vborg.vbsupport.ru/showthread.php?t=139093

StarBuG


Thank you, I guess I need to learn how to search better. :eek:

Alien 02-11-2007 11:49 PM

How would I adjust this, so that even registered members (like guests) will see an ad on the second post of EVERY page. I'd still like registered members to only see the thin display as you have it.

We have a 'premium user' class that we'll show zero ads for.

Thank you so much!

StarBuG 02-12-2007 05:46 AM

Quote:

Originally Posted by insolentmuse (Post 1179982)
Thank you, I guess I need to learn how to search better. :eek:

No.
I published it because you were the first to ask ;)

insolentmuse 02-12-2007 06:46 AM

Quote:

Originally Posted by StarBuG (Post 1180416)
No.
I published it because you were the first to ask ;)

Oh good, then I'm not completely incompetent.

It works great, btw :) Thanks!

Alien 02-13-2007 09:33 AM

No matter what I do with all of your suggestions, I can't exclude a usergroup no matter which method I use...

Can anyone confirm a method that works perfectly?

StarBuG 02-13-2007 07:42 PM

<if condition="THIS_SCRIPT == 'showthread' AND $post[postid] == $GLOBALS['qrfirstpostid'] AND ($show[member]) AND $bbuserinfo['usergroupid'] != 'X'">

This means... if user is a registered member and NOT a member of usergroup X then show the advertising.

StarBuG

Alien 02-13-2007 11:08 PM

That code would seem not to work with any users who don't have the usergroup as top level.

How would I get this:

<if condition="is_member_of($bbuserinfo,14)">

...to work inside of YOUR conditional? :) Usergroup 14 above is my "Premium" group, but I don't put members in their as their MAIN group.

Wrapping the whole conditional I just stated around the "ads for members" section of your code will NOT work. There is a conflict somehow contained in your if if I put my if before it (which has worked before when I simply put the google ads at the top of the showthread before I tried your mod).. Any suggestions? :)

Alien 02-14-2007 12:17 AM

I found the resolution...

In order to not show this to a particular group (difference here being this works even if it's not their MAIN group), insert this code instead..

Code:

<!-- Google AdSense in Posts for Members -->
<if condition="THIS_SCRIPT == 'showthread' AND  $post[postid] == $GLOBALS['qrfirstpostid'] AND ($show[member]) AND !is_member_of($bbuserinfo, X, X, X)">

Where X, X, X is the usergroup id's you DON'T want to see the ads. Mine is 14, which is my premium group, and I also added my staff groups. I want everyone else to see them. Of course if a person is a guest, he'll still see the large format ads.

Hope that helps someone...

StarBuG 02-14-2007 07:05 AM

Yes, that works as well

Glad you figured it out ;)

If you lose the ! before "is_member_of", the statement will only include the usergroups you named (X) by the way ;)

Cheertobi 02-20-2007 06:39 PM

What is this condition good for?!

Code:

<if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>
Tobi

StarBuG 02-21-2007 06:14 PM

This code is copied from the "postbit_wrapper" template.

Here it does not serve any purpose.
I just forgot to take it out.
You can delete it if you want.

It is just an html comment that is added when the the above post is followed by another one.

StarBuG

2 FN LOW 02-27-2007 08:32 PM

how do you know what postbit you use?

StarBuG 02-28-2007 02:30 PM

If you are asking that, then you are using the "postbit" template ;)

To use the "postbit_legacy" template you have to copy the content from that template to "Postbit" ;)

ccmoon 03-17-2007 03:55 AM

Thanks for this great hack. However, I don't like guest to see the "wide" ad, it looks early that way. How do I make guest will see ads the same way as registered users?
Thanks

StarBuG 03-17-2007 07:05 AM

If you want everyone to see the same ad you don't need the coditions.
Simply only use the member code and get rid of all the rest.

use this:
Code:

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>   
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="td_post_$post[postid]">
  <div class="normal">
        &nbsp;
    </div>
    </td>
</tr>
<tr>
    <td class="alt1" align="center">
        <div>
    <!-- Adsense standard banner start -->
      <script type="text/javascript"><!--
      google_ad_client = "pub-5988350962952956";
      google_ad_width = 468;
      google_ad_height = 60;
      google_ad_format = "468x60_as";
      google_ad_type = "text";
      google_ad_channel = "5238041056";
      //--></script>
      <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
    <!-- Adsense standard banner End -->
        </div>
    </td>
</tr>
</tbody>
</table>

then everyone including members, guests, admins, mods etc are seeing your ad as second post.

DiSpy 03-31-2007 04:50 PM

Hi,

How can I change this so that it shows up as the last post on a page? (instead of the second post)

THANKS! :D

tsptom 03-31-2007 05:12 PM

use this as your 1st IF statement:

Code:

<if condition="$post[postcount] == 10">


All times are GMT. The time now is 04:59 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.01453 seconds
  • Memory Usage 1,862KB
  • 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
  • (13)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete