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)
-   -   Forum Home Enhancements - [FORUM-HOME] Add Notices/Advertisements to Forums on homepage (https://vborg.vbsupport.ru/showthread.php?t=312048)

addamroy 06-09-2014 10:00 PM

[FORUM-HOME] Add Notices/Advertisements to Forums on homepage
 
1 Attachment(s)
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!

Davey-UK 06-11-2014 05:47 PM

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.

addamroy 06-11-2014 08:55 PM

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;
}


Davey-UK 06-12-2014 01:45 PM

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.

addamroy 06-12-2014 04:27 PM

Let me know what you come up with for that. I'd certainly update the code here.


All times are GMT. The time now is 08:37 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.02372 seconds
  • Memory Usage 1,720KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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