Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Template Modifications
Replace 1st & 2nd signatures with ads/other code Details »»
Replace 1st & 2nd signatures with ads/other code
Version: 1.00, by karlm karlm is offline
Developer Last Online: May 2018 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.6.7 Rating:
Released: 06-21-2007 Last Update: Never Installs: 4
Template Edits
Re-useable Code  
No support by the author.

Hi all,

I was thinking of a way to place advertisements in my forum without distrupting the display too much... this is what I came up with.

Enter your ADMIN CP, select Styles & Templates, then select Style Manager and open up the skin you wish to amend (the main skin would be the obvious choice, or all if necessary) and finally, expand all template groups fully and select postbit.

Seach for:
HTML Code:
		<!-- sig -->
			<div>
				__________________<br />
				$post[signature]
			</div>
		<!-- / sig -->
And replace it with the below code.

HTML Code:
<!-- sig -->
<br />  
<if condition="$post['signature']">
<!-- applying adsense to FIRST post -->
<if condition="(($post[postcount] % $vboptions[maxposts] == 1)) and (!is_member_of($bbuserinfo,30))">
<span style="margin: 2px; float: left; width: 730px; height: 20px;">
 
<!-- YOUR GOOGLE CODE FOR 728*15 GOES HERE -->
 
</span><br />
</if>
<!-- applying adsense to FIRST post -->
<else />
<!-- applying adsense to FIRST post -->
<if condition="(($post[postcount] % $vboptions[maxposts] == 1)) and (!is_member_of($bbuserinfo,30))">
<span style="margin: 2px; float: left; width: 730px; height: 20px;">
 
<!-- YOUR GOOGLE CODE FOR 728*15 GOES HERE -->
 
</span>
<br /></if>
<!-- applying adsense to FIRST post -->
</if>
<if condition="(($post[postcount] % $vboptions[maxposts] == 1)) and (is_member_of($bbuserinfo,30))">
<fieldset style="color: #666666"><legend>$post[username]'s Sig:</legend><div class="smallfont">
$post[signature]</div></fieldset></if>
 
<!-- applying adsense to SECOND post -->
<if condition="$post['signature'] and (($post[postcount] % $vboptions[maxposts] == 2)) and (!is_member_of($bbuserinfo,30))">
<span style="margin: 2px; float: left; width: 730px; height: 90px;">
 
<!-- YOUR GOOGLE CODE FOR 728*90 GOES HERE -->
 
</span><br />
<!-- applying adsense to SECOND post -->
<else />
<!-- applying adsense to SECOND post -->
<if condition="(($post[postcount] % $vboptions[maxposts] == 2)) and (!is_member_of($bbuserinfo,30))">
<span style="margin: 2px; float: left; width: 730px; height: 90px;">
 
<!-- YOUR GOOGLE CODE FOR 728*90 GOES HERE -->
 
</span><br /></if></if>
<!-- applying adsense to SECOND post -->
<if condition="(($post[postcount] % $vboptions[maxposts] == 2)) and (is_member_of($bbuserinfo,30))">
<fieldset style="color: #666666"><legend>$post[username]'s Sig:</legend><div class="smallfont">
$post[signature]</div></fieldset></if>
<if condition="(($post[postcount] % $vboptions[maxposts] >= 3)) and $post['signature']">
<fieldset style="color: #666666"><legend>$post[username]'s Sig:</legend><div class="smallfont">
$post[signature]</div></fieldset></if>
     <!-- / sig -->
What this code does is it checks a few conditions.

1) It checks whether the post displayed is the first or second.
2a) If it is the 1st it then checks whether user has a signature or not.
2b) If it is the 2nd it then checks whether user has a signature or not.
3a) If the user has a signature (post #1), it replaces it with a google link-unit 728x15.
3b) If the user has a signature (post #2), it replaces it with a google link-unit 728x90.
4) If the user doesn't have a signature - it uses the google-ad code regardless for both posts #1 and #2.
5) It also checks whether the viewer (not the poster) is on a subscription group and removes all adverts as well as leaving the original signatures in place. This serves as a great way to promote membership contribution.

6) It does a last check that makes sure any posts of #3 or above are ignored for signature replacing. This works on a page by page basis. So, for example, if you had a thread with 35 replies, spread over four pages (10,10,10,5), it would replace posts 1,2,11,12,21,22,31 and 32.

Remember you need to amend the a code to reflect the usergroup that YOUR forum uses for ad-less usergroup. In MY example, it is usergroup 30, yours will undoubtedly be a different number/s. If you have multiple usergroups that do not see adverts (e.g. supports, admins & mods), then simply use a comma to separate them:
HTML Code:
<if condition="(($post[postcount] % $vboptions[maxposts] == 2)) and (is_member_of($bbuserinfo,30,31,32))">
I'm fairly confident there must be a considerably smaller & quicker means of doing this - but I'm not overly experienced with php. This is my second offering of a 'hack'. It works well on my forum and the members seem not to mind it at all.

If you use it at all - even for just 20 minutes - please leave feed back of your thoughts and don't forget to click Install if you actually make use of it on a live forum.

Thank you, and enjoy!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 06-22-2007, 12:11 PM
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Location: England
Posts: 447
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For a working demonstration, drop by my forum and select any thread you want.
Reply With Quote
  #3  
Old 06-23-2007, 02:55 AM
rjmjr69's Avatar
rjmjr69 rjmjr69 is offline
 
Join Date: Jan 2007
Location: Southie
Posts: 876
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How many queries does this add?
Reply With Quote
  #4  
Old 06-23-2007, 08:13 PM
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Location: England
Posts: 447
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erm.
God knows.

Seriously, I've no idea at all... Sorry.
Reply With Quote
  #5  
Old 09-28-2007, 09:54 PM
jmw jmw is offline
 
Join Date: Jan 2005
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by karlm View Post
Erm.
God knows.

Seriously, I've no idea at all... Sorry.
LOL! Can't install.
Reply With Quote
  #6  
Old 09-29-2007, 01:14 AM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think that this would seriously upset many of the users on my forum - they are quite attached to their sigs.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07039 seconds
  • Memory Usage 2,260KB
  • Queries Executed 21 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete