vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Randomly positioned ad in between postbits in showthread (https://vborg.vbsupport.ru/showthread.php?t=98057)

UK Jimbo 10-09-2005 10:00 PM

Randomly positioned ad in between postbits in showthread
 
Inspired by this hack.

The ad is positioned randomly after one of the postbits. We use this for positioning adsense ads on visordown.com.

Install the attached plugin then add the following code to your postbit or postbit_legacy template:

HTML Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links</td>
</tr>
<tr>
        <td class="alt1" align="center">

<!-- ad code goes here -->

        </td>
</tr>
</table>

</div>
$spacer_close
</if>


Changelog

v1.01
Bug fix: The ad code shouldn't appear on PMs any more (template change)

Donations

Hopefully this plugin will earn you provide you with some good revenue. If you'd like to show your appreciation please donate as little or as much as you like.

https://vborg.vbsupport.ru/external/2010/02/12.gif

Wachtmeister 10-10-2005 07:44 PM

I'll give this one a try, because the "Adsense after first post" did not work with Firefox at "Quick Reply". Thanks for releasing this one.

edit: works perfect.

dieselpowered 10-10-2005 08:20 PM

I had the same problem with the adsense code affecting the functionality of AJAX. Quick reply would work ONLY if you did not have to click to activate it. One thing you may want to test is to attempt to click quick reply in a post AFTER the display of the adsense and see if it works.

The code I have now will allow you to click quick reply in a post above the adsense, however, not in a post below it.

If this works I will be using it :)

DeeperImage 10-11-2005 01:53 AM

I've installed the plugging and the code and this is not working, What am I doing wrong? Thanks.

It just doesn't show up.

auz1111 10-11-2005 02:28 AM

nice one! just wish we could add/edit the ads without going into the template.

hbalagh1 10-11-2005 03:35 AM

can you select certain usergroups not to see this?

Keyser S?ze 10-11-2005 04:57 AM

yea i got the same question, id prefer only guests see the ads, not logged in members, i get more guests than anything

GrendelKhan{TSU 10-11-2005 05:01 AM

mandatory "is there a screen shot?" request. ;) :p

Doc Great 10-11-2005 08:38 AM

To make only guest see the ads take this code and add it at the end of the postbit (_legacy) template.

Code:

<if condition="in_array($bbuserinfo[usergroupid], array(1))">
<if condition="$GLOBALS['adsense_position'] == $post['postcount']">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links</td>
</tr>
<tr>
        <td class="alt1" align="center">

<!-- ad code goes here -->

        </td>
</tr>
</table>

</div>
$spacer_close
</if>
</if>

@UK Jimbo, do you allow me to translate/modify and post this modification @ www.vbhacks-germany.com (of course with your copyright)? :)

UK Jimbo 10-11-2005 09:36 AM

Thanks for posting the usergroup variation Doc Great. I've got no issues with you re-posting the code elsewhere as long as it's not being sold!

UK Jimbo 10-11-2005 09:41 AM

Quote:

Originally Posted by GrendelKhan{TSU
mandatory "is there a screen shot?" request. ;) :p

done

Doc Great 10-11-2005 10:17 AM

Quote:

Originally Posted by UK Jimbo
Thanks for posting the usergroup variation Doc Great. I've got no issues with you re-posting the code elsewhere as long as it's not being sold!

Thats for sure :) i hate making profit with "simple" php code :D Thanks for sharing.

dsotmoon 10-11-2005 04:48 PM

how do you add additional usergroups? to

Code:

<if condition="in_array($bbuserinfo[usergroupid], array(1))">
like this?

Code:

<if condition="in_array($bbuserinfo[usergroupid], array(1, 2, 3, 4))">
ect etc?

dieselpowered 10-11-2005 04:49 PM

This does appear to work with click for quick reply.

**clicks install**

UK Jimbo 10-11-2005 05:07 PM

To limit it just to certain user groups I'd recommend the following conditional rather than the in_array() solution posted above. This version ensures that secondary group assignments are checked too.

For a single user group (1 in this case)
PHP Code:

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

For multiple user groups (1, 2 & 3 in this case)
PHP Code:

<if condition="is_member_of($bbuserinfo, array(1,2,3))"


Andreas 10-11-2005 05:30 PM

What about:
Show Adsense in (or under, above) first unread Post of a Thread.
I think this is the place that would get the most user attention?

UK Jimbo 10-11-2005 05:55 PM

That's a nice idea and one I'll look into. I think it will be possible to use the $threadview variable but it'll require slightly more CPU and will have to deal with cases where the latest the newest post isn't displayed on the page.

dieselpowered 10-11-2005 06:36 PM

How can I get this to not show in the PM's???

For some reason it is screwing up the page formatting when viewing private messages.

hbalagh1 10-11-2005 06:39 PM

Quote:

Originally Posted by xtremeoff-road
How can I get this to not show in the PM's???

For some reason it is screwing up the page formatting when viewing private messages.

same here, didn't even bother to check that till you said that...

dieselpowered 10-11-2005 06:53 PM

Quote:

Originally Posted by hbalagh1
same here, didn't even bother to check that till you said that...

Ya I was surprised to see it there as well :surprised:

DeeperImage 10-11-2005 07:23 PM

Quote:

Originally Posted by xtremeoff-road
How can I get this to not show in the PM's???

For some reason it is screwing up the page formatting when viewing private messages.

I've installed and no-one seems to care about my question, but nonetheless this hack only works in the PM's section with my site and nowhere else, and like you said it is messing up with the recipients name, it's adding an extra space and a ; to it.

UK Jimbo 10-11-2005 07:24 PM

Quote:

Originally Posted by xtremeoff-road
How can I get this to not show in the PM's???

For some reason it is screwing up the page formatting when viewing private messages.

Sorry this is one I didn't see as only guests on visordown.com have the ads turned on.

This problem can be fixed with a simple template change. I've adjusted the code listed above to include the additional condition: $GLOBALS['adsense_position'] > 0

UK Jimbo 10-11-2005 07:25 PM

Quote:

Originally Posted by DeeperImage
I've installed and no-one seems to care about my question

Awwwwww :(

Copy/paste the code you've put in your template and I'll try to help.

dieselpowered 10-11-2005 07:28 PM

Quote:

Originally Posted by DeeperImage
I've installed and no-one seems to care about my question, but nonetheless this hack only works in the PM's section with my site and nowhere else, and like you said it is messing up with the recipients name, it's adding an extra space and a ; to it.

Just a shot in the dark, however, do you have the correct postbit template changed? Appears you are using the postbit_legacy so did you change that template?? The code goes at the very end.

DeeperImage 10-11-2005 07:32 PM

Quote:

Originally Posted by xtremeoff-road
Just a shot in the dark, however, do you have the correct postbit template changed? Appears you are using the postbit_legacy so did you change that template?? The code goes at the very end.

I tried it both in Postbit and Postbit_legacy and it was all the same. It does not show up. I am using a test account I created and my normal admin account and the only place I see it is in PM's

dieselpowered 10-11-2005 07:32 PM

Quote:

Originally Posted by UK Jimbo
Sorry this is one I didn't see as only guests on visordown.com have the ads turned on.

This problem can be fixed with a simple template change. I've adjusted the code listed above to include the additional condition: $GLOBALS['adsense_position'] > 0

Hey man, sorry but that errors out...won't even let me save the template with the new code?

DeeperImage 10-11-2005 07:33 PM

Quote:

Originally Posted by UK Jimbo
Awwwwww :(

Copy/paste the code you've put in your template and I'll try to help.


I've placed it at the end right after

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

<if condition="$show['spacer']">
</div>
$spacer_close
</if>
<!-- / post #$post[postid] -->

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount']">
$spacer_open 
<div style="padding:0px 0px $stylevar[cellpadding]px 0px"

<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center"
<
tr
    <
td class="thead" align="left">Sponsored Links</td
</
tr
<
tr
    <
td class="alt1" align="center">

<
script type="text/javascript"><!--
google_ad_client "removed for obvious reasons";
google_ad_width 728;
google_ad_height 90;
google_ad_format "728x90_as";
google_ad_type "text_image";
google_ad_channel ="";
google_color_border "191933";
google_color_bg "333366";
google_color_link "99CC33";
google_color_url "FFCC00";
google_color_text "FFFFFF";
//--></script>
<script type="text/javascript"
  
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</
script>

    </
td
</
tr
</
table

</
div
$spacer_close 
</if> 


UK Jimbo 10-11-2005 07:41 PM

Quote:

Originally Posted by xtremeoff-road
Hey man, sorry but that errors out...won't even let me save the template with the new code?

Are you using the full conditional as per the template mod at the top of the page?

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0"


dieselpowered 10-11-2005 07:41 PM

Quote:

Originally Posted by DeeperImage
I've placed it at the end right after

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

<if condition="$show['spacer']">
</div>
$spacer_close
</if>
<!-- / post #$post[postid] -->

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount']">
$spacer_open 
<div style="padding:0px 0px $stylevar[cellpadding]px 0px"

<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center"
<
tr
    <
td class="thead" align="left">Sponsored Links</td
</
tr
<
tr
    <
td class="alt1" align="center">

<
script type="text/javascript"><!--
google_ad_client "removed for obvious reasons";
google_ad_width 728;
google_ad_height 90;
google_ad_format "728x90_as";
google_ad_type "text_image";
google_ad_channel ="";
google_color_border "191933";
google_color_bg "333366";
google_color_link "99CC33";
google_color_url "FFCC00";
google_color_text "FFFFFF";
//--></script>
<script type="text/javascript"
  
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</
script>

    </
td
</
tr
</
table

</
div
$spacer_close 
</if> 


I wonder if that threaded view above your forums is messing it up? Looking at the code nothing really stood out as wrong??

You already installed the plugin right? Is it active?

dieselpowered 10-11-2005 07:44 PM

Quote:

Originally Posted by UK Jimbo
Are you using the full conditional as per the template mod at the top of the page?

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0"


Hmmm ya I was...I reverted and replaced the code. All is good now :)

Appreciate it sir!

dieselpowered 10-11-2005 07:46 PM

Quote:

Originally Posted by UK Jimbo
Are you using the full conditional as per the template mod at the top of the page?

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0"


Sorry, quick question....can this code be placed above it so that specific usergroups do not see the ads?

PHP Code:

<if condition="in_array($bbuserinfo[usergroupid], array(1, 2, 3, 4))"


UK Jimbo 10-11-2005 07:47 PM

Quote:

Originally Posted by xtremeoff-road
I wonder if that threaded view above your forums is messing it up?

The ad will only ever appear in the "linear" display mode. In "hybrid" or "threaded" mode it's disabled.

UK Jimbo 10-11-2005 07:50 PM

Quote:

Originally Posted by xtremeoff-road
Sorry, quick question....can this code be placed above it so that specific usergroups do not see the ads?

I'd recommend using is_member_of() in place of in_array()

You can either use:

PHP Code:

<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0 && is_member_of($bbuserinfo,array(1,2,3))"

or put it in a separate outer conditional like:

PHP Code:

<if condition="is_member_of($bbuserinfo,array(1,2,3))">
<if 
condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0"


dieselpowered 10-11-2005 07:57 PM

Quote:

Originally Posted by UK Jimbo
I'd recommend using is_member_of() in place of in_array()

Sorry that is the conditional I meant to copy and paste :)

Thanks for the help!

DeeperImage 10-11-2005 08:03 PM

Quote:

Originally Posted by xtremeoff-road
I wonder if that threaded view above your forums is messing it up? Looking at the code nothing really stood out as wrong??

You already installed the plugin right? Is it active?


I use linear as my default and it does not work. I think the threaded view is for the non registered only. I'll change it to be safe all around.

The plugging I installed and it is active. When I upload the pluging what do I select from the drop down? I put it under Ajax_start is that the correct mode?

dieselpowered 10-11-2005 08:09 PM

Quote:

Originally Posted by DeeperImage
I use linear as my default and it does not work. I think the threaded view is for the non registered only. I'll change it to be safe all around.

The plugging I installed and it is active. When I upload the pluging what do I select from the drop down? I put it under Ajax_start is that the correct mode?

I guess I do not understand what you mean by mode. When you import a plugin all you do is browse to the .xml and select import...that is all.

**Edit**

I see what you are talking about...do not go to 'add new plugin' look at the bottom where it shows upload/download plugin and then import the .xml file.

DeeperImage 10-11-2005 08:15 PM

Quote:

Originally Posted by xtremeoff-road
I guess I do not understand what you mean by mode. When you import a plugin all you do is browse to the .xml and select import...that is all.

**Edit**

I see what you are talking about...do not go to 'add new plugin' look at the bottom where it shows upload/download plugin and then import the .xml file.

Ahh I see . Let me try. This was my first pluging install. :ermm: I'll report back in a few.

dieselpowered 10-11-2005 08:20 PM

Quote:

Originally Posted by DeeperImage
Ahh I see . Let me try. This was my first pluging install. :ermm: I'll report back in a few.

Roger that...standing by :)

dieselpowered 10-11-2005 08:21 PM

Quote:

Originally Posted by DeeperImage
Ahh I see . Let me try. This was my first pluging install. :ermm: I'll report back in a few.

Hey it works!!!

DeeperImage 10-11-2005 08:21 PM

Quote:

Originally Posted by xtremeoff-road
Roger that...standing by :)

That was exactly the problem..Thank you much. I manually added the pluging instead of importing into it with the automated system.. :nervous: :nervous: :nervous: :ermm: But all is well now. I hope the results are even better...Money wise.. :devious:


All times are GMT. The time now is 11:03 AM.

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.01619 seconds
  • Memory Usage 1,891KB
  • 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
  • (1)bbcode_html_printable
  • (10)bbcode_php_printable
  • (24)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