Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
[FORUM-HOME] Add Notices/Advertisements to Forums on homepage Details »»
[FORUM-HOME] Add Notices/Advertisements to Forums on homepage
Version: 1.00, by addamroy addamroy is offline
Developer Last Online: Jan 2018 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 4.2.x Rating:
Released: 06-09-2014 Last Update: Never Installs: 6
Template Edits
Re-useable Code Translations  
No support by the author.

This hack will allow you to add custom Notices/Advertisements/Messages underneath individual forums on the forum home page.

For example you could put a custom no-permission notice underneath your private forums with a link to your sales thread. You could place advertisements or any other links/text underneath specific forums on your home page.

You need to make 2 simple template edits to make this happen.

Step 1 - Add the following to the end of your additional.css template |
Styles & Templates > Edit Templates > CSS Templates > Additional.css

Code:
/* Forum Notice Box */

.forum_notice_box {
margin-top:52px;
margin-bottom:10px;
margin-left:-1px;
margin-right:-1px;
padding-left:5px;
padding-bottom:8px;
background-color:#d00000;
color:white;
font-size:12px;
}

.forum_notice_box_text {
position:relative;
top:3px;
}
Step 2 - Open your forumhome_forumbit_level2_post template |
Styles & Templates > Edit Templates > FORUMHOME Templates > forumhome_forumbit_level2_post

In this template find:
Code:
<vb:if condition="$childforumbits">
Add this code right above it:
Code:
<!-- Forum Notice Box -->

<vb:if condition="$forum[forumid] == 402">
<vb:if condition="is_member_of($bbuserinfo, 6,7,8)">

<div class="forum_notice_box">

<div class="forum_notice_box_text">
You're seeing this message because you don't have access to the private forums.&nbsp;&nbsp;  More information at <a href="http://www.Yourforumcom/thread-link">
<span style="color:#ffffff;">http://www.Yourforumcom/thread-link</span>
</a>
</div>

</div>

</vb:if>
</vb:if>

<!-- Forum Notice Box -->
Change your FORUM ID to the ID of the forum you wish to display your message on.

Change USERGROUP IDs to the IDs of the usergroups that CAN see this message.

Change your URLs and/or adjust the message to suit your needs.

You MAY have to change the Margin-top: value to suit your forum's needs if your forumbits are different heights

That's it! Repeat step 2 for each forum you wish to display a custom notice under.

Mark as installed!

Screenshots

File Type: png example1.png (13.4 KB, 0 views)

Show Your Support

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

Comments
  #2  
Old 06-11-2014, 05:47 PM
Davey-UK's Avatar
Davey-UK Davey-UK is offline
 
Join Date: Feb 2003
Location: Sheffield-UK
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is simpler to add everything into an array like so:
Code:
<!-- Forum Notice Box -->

<vb:if condition="in_array($forum['forumid'], array(13,14,15,16,17)) AND is_member_of($bbuserinfo, 6,15,9)">

<div class="forum_notice_box">

<div class="forum_notice_box_text">
You're seeing this message because you don't have access to these forums.&nbsp;&nbsp;  Upgrade <a href="http://www.mysite.com/forumhome/payments.php">
<span style="color:#ffffff;">HERE</span>
</a>
</div>

</div>

</vb:if>

<!-- Forum Notice Box -->
Nice little edit, but i get a problem, that the forum titles are not clickable anymore when this notice is in place. Not good for Mr Google i wouldn't imagine.
Reply With Quote
  #3  
Old 06-11-2014, 08:55 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are correct on using that string as opposed to mine, that is an easier option. (I am not as code savvy when it comes to vb code and conditionals)

There was a missing piece of the CSS style in additional CSS.

Use this code in the additional.css. Change the margin-top:52px value if your forumbits have a custom height. It will solve the unclickable problem.

Code:
/* Forum Notice Box */

.forum_notice_box {
margin-top:52px;
margin-bottom:10px;
margin-left:-1px;
margin-right:-1px;
padding-left:5px;
padding-bottom:8px;
background-color:#d00000;
color:white;
font-size:12px;
}

.forum_notice_box_text {
position:relative;
top:3px;
}
Reply With Quote
  #4  
Old 06-12-2014, 01:45 PM
Davey-UK's Avatar
Davey-UK Davey-UK is offline
 
Join Date: Feb 2003
Location: Sheffield-UK
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm working on it, because if you just add a new height, that doesnt look good if you have many sub forums, as obviously the height of the cell gets bigger, the more sub forums you have under a parent forum.
Reply With Quote
  #5  
Old 06-12-2014, 04:27 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Let me know what you come up with for that. I'd certainly update the code here.
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 02:49 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.03945 seconds
  • Memory Usage 2,257KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (1)postbit_attachment
  • (5)postbit_onlinestatus
  • (5)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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete