Tag Archives: Vbadvanced

vBA news module customization (avoid topic links display)

A client’s vBulletin board uses vbadvaced news module to display posts from a hidden forum. Every post is wrapped with adv_portal_module_wrapper.

My client did not want the topic links to be displayed, so he asked me to hack the code to achieve this.

Change adv_portal_module_wrapper

The adv_portal_module_wrapper you will find in you ACP —> style manager —> in the drop down for which ever style your working on pick edit templates —> vbadvanced cmps templates —> adv_portal_module_wrapper (should be located halfway down in the list of templates)

However you might want to copy that template and make a new one in case you need the default, you can add one by ACP —> style manager —> the add template. copy and paste your adv_portal_module_wrapper contents in for a starting point.

The following is the original code of adv_portal_module_wrapper:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$mods[formcode]
 
<div style="padding-bottom:$vba_style[portal_vspace]px">
	<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
		<thead>
			<tr>
				<td class="tcat" colspan="$mods[colspan]">
				<if condition="$vba_style['portal_collapsemods']">
					<a href="#top" onclick="return toggle_collapse('module_$mods[collapse]')" style="float:$stylevar[right]"><img alt="" border="0" id="collapseimg_module_$mods[collapse]" src="$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif" /></a>
				</if>
				<span class="smallfont"><strong>$vba_style[portal_blockbullet] <if condition="$mods['link']"><a href="$mods[link]">$mods[title]</a><else />$mods[title]</if></strong></span></td>
			</tr>
		</thead>
		<tbody id="collapseobj_module_$mods[collapse]" style="$modcollapse">
			<if condition="$show['tablerow']">
				<tr>
					<td class="$bgclass">
						$modulehtml
					</td>
				</tr>
			<else />
				$modulehtml
			</if>
		</tbody>
	</table>
</div>
<if condition="$show['endform']"></form></if>

I noticed the links where being created with the $mods[title] (refer to line 11). So where is this variable defined? Thanks to grep linux command I found out where it was assigned a value:

/includes/vba_cmps_include_top.php
/modules/news.php

In /modules/news.php there is this line, which gave me the clue on how to solve this issue

$mods['title'] = ($news['prefix'] ? $news['prefix'] : '') . ' <a href="' . $vbulletin->options['bburl'] . '/showthread.php?' . $vbulletin->session->vars['sessionurl'] . 't=' . $news['threadid'] . '">' . $news['title'] . '</a>';

So I thought I’d change the $mods['title'] call in adv_portal_module_wrapper to $news['title'], so my resulting copy of adv_portal_module_wrapper is called adv_portal_module_wrapper_miguel and is like follows (the only thing changed is line 11):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$mods[formcode]
<!-- adv_portal_module_wrapper_miguel -->
<div style="padding-bottom:$vba_style[portal_vspace]px">
	<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
		<thead>
			<tr>
				<td class="tcat" colspan="$mods[colspan]">
				<if condition="$vba_style['portal_collapsemods']">
					<a href="#top" onclick="return toggle_collapse('module_$mods[collapse]')" style="float:$stylevar[right]"><img alt="" border="0" id="collapseimg_module_$mods[collapse]" src="$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif" /></a>
				</if>
				<span class="smallfont"><strong>$vba_style[portal_blockbullet] $news[title]</strong></span></td>
			</tr>
		</thead>
		<tbody id="collapseobj_module_$mods[collapse]" style="$modcollapse">
			<if condition="$show['tablerow']">
				<tr>
					<td class="$bgclass">
						$modulehtml
					</td>
				</tr>
			<else />
				$modulehtml
			</if>
		</tbody>
	</table>
</div>
<if condition="$show['endform']"></form></if>

vBulletin: adsense module for vBAdvanced [SOLVED]

vBulletin users usually purchase vBAdvanced to increase their forums potential. It is a great tool for doing things like:

Creating google adsense module

For my adsense ads in my right column I just created a simple template with the Adsense script inside of a <center> tag.

Follow this steps:

1 AdminCP > vBa CMPS > Add Module > Template Module
2I called mine adv_portal_publicidad but you can call yours anything you want after the “adv_portal_” part. Copy & past the code below into the template. Change the parts inside of the “script” tags to be your own code that the Google Adsense page generated for you. Save the template.

<center>
<script type="text/javascript"><!--
google_ad_client = "pub-8302299911530853";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="6330441493";
google_color_border = "B4D0DC";
google_color_bg = "ECF8FF";
google_color_link = "0000CC";
google_color_url = "008000";
google_color_text = "6F6F6F";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>

3Edit your “homepage” page in vBa panel and include the adv_portal_publicidad module in the right column.

That’s all, folks!

vBulletin + vBAdvanced: Display google news RSS feed

A client of mine asked to show a “Google News” RSS feed in his vbulletin forum board. More precisely, he wants this RSS feed to be shown in the main page of the vBAdvanced “home” page.

The RSS url to display is: http://news.google.es/news?pz=1&cf=all&ned=es&hl=es&topic=h&num=3&output=rss

First step: create a custom php file using Google AJAX Feed API. For further instructions refer to the the google ajax feed api reference manual. This file includes the visualization options and a custom CSS.

Mine is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<!-- ++Begin Dynamic Feed Wizard Generated Code++ -->
  <!--
  // Created with a Google AJAX Search and Feed Wizard
  // http://code.google.com/apis/ajaxsearch/wizards.html
  -->
 
  <!--
  // The Following div element will end up holding the actual feed control.
  // You can place this anywhere on your page.
  -->
  <div class="tborder" style="background-color:#FFF; padding:3px; margin:3px;">
    <div id="feed-control">
      <span style="color:#ffffff;font-size:11px;margin:10px;padding:5px;">Loading...</span>
    </div>
  </div>
 
  <!-- Google Ajax Api
  -->
  <script src="http://www.google.com/jsapi?key=notsupplied-wizard"
    type="text/javascript"></script>
 
  <!-- Dynamic Feed Control and Stylesheet -->
  <script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js"
    type="text/javascript"></script>
  <style type="text/css">
   .gfg-root {
  width : 100%;
  height : auto;
  position : relative;
  overflow : hidden;
  text-align : center;
  font-family: "Arial", sans-serif;
  font-size: 12px;
  border: 1px solid #BCCDF0;
}
 
.gfg-title {
  font-size: 14px;
  font-weight : bold;
  color : #3366cc;
  /*background-color: #E5ECF9;*/
  background-color: #ffffff;
  line-height : 1.4em;
  overflow : hidden;
  white-space : nowrap;
}
 
.gfg-title a {
  color : #3366cc;
}
 
.gfg-subtitle {
  font-size: 12px;
  font-weight : bold;
  color : #3366cc;
  /*background-color: #E5ECF9;*/
  background-color: #ffffff;
  line-height : 1.4em;
  overflow : hidden;
  white-space : nowrap;
  margin-bottom : 5px;
}
 
.gfg-subtitle a {
  color : #3366cc;
}
 
.gfg-entry {
  background-color : white;
  width : 100%;
  height : 6.9em;
  position : relative;
  overflow : hidden;
  text-align : left;
  margin-top : 3px;
}
 
/* To allow correct behavior for overlay */
.gfg-root .gfg-entry .gf-result {
  position : relative;
  background-color : white;
  width : auto;
  height : 100%;
  padding-left : 20px;
  padding-right : 5px;
}
 
.gfg-list {
  position : relative;
  overflow : hidden;
  text-align : left;
  margin-bottom : 5px;
}
 
.gfg-listentry {
  line-height : 1.5em;
  overflow : hidden;
  white-space : nowrap;
  text-overflow : ellipsis;
  -o-text-overflow : ellipsis;
  padding-left : 15px;
  padding-right : 5px;
  margin-left : 5px;
  margin-right : 5px;
}
 
.gfg-listentry-odd {
  /*background-color : #F6F6F6;*/
  background-color:#FFF;
}
 
.gfg-listentry-even {
}
 
.gfg-listentry-highlight { 
  background-image : url('garrow.gif');
  background-repeat: no-repeat;
  background-position : center left;
}
 
/*
 * FeedControl customizations.
 */
 
.gfg-root .gfg-entry .gf-result .gf-title {
  font-size: 14px;
  line-height : 1.2em;
  overflow : hidden;
  white-space : nowrap;
  text-overflow : ellipsis;
  -o-text-overflow : ellipsis;
  margin-bottom : 2px;
}
 
.gfg-root .gfg-entry .gf-result .gf-snippet {
  height : 3.8em;
  color: #000000;
  margin-top : 3px;
}
 
/*
 * Easy way to get horizontal mode, applicable via js options to gadget.
 */
 
.gfg-horizontal-container {
  position : relative;
}
 
.gfg-horizontal-root {
  height : 1.5em;
  _height : 100%;
  position : relative;
  white-space : nowrap;
  overflow : hidden;
  text-align : center;
  font-family: "Arial", sans-serif;
  font-size: 13px;
  border: 1px solid #AAAAAA;
  padding : 5px;
  margin-right : 80px;
}
 
.gfg-horizontal-root .gfg-title {
  font-weight : bold;
  background-color: #FFFFFF;
  line-height : 1.5em;
  overflow : hidden;
  white-space : nowrap;
  float : left;
  padding-left : 10px;
  padding-right : 12px;
  border-right: 1px solid #AAAAAA;
}
 
.gfg-horizontal-root .gfg-title a {
  color : #444444;
  text-decoration : none;
}
 
.gfg-horizontal-root .gfg-entry {
  width : auto;
  height : 1.5em;
  position : relative;
  overflow : hidden;
  text-align : left;
  margin-top : 0px;
  margin-left : 0px;
  padding-left : 10px;
}
 
/* To allow correct behavior for overlay */
.gfg-horizontal-root .gfg-entry .gf-result {
  position : relative;
  background-color : white;
  width : 100%;
  height : 100%;
  line-height : 1.5em;
  overflow : hidden;
  white-space : nowrap;
}
 
.gfg-horizontal-root .gfg-list {
  display : none;
}
 
/*
 * FeedControl customizations.
 */
 
.gfg-horizontal-root .gfg-entry .gf-result .gf-snippet,
.gfg-horizontal-root .gfg-entry .gf-result .gf-author {
  display : none;
}
 
.gfg-horizontal-root .gfg-entry  .gf-result .gf-title {
  color: #0000cc;
  margin-right : 3px;
  float : left;
}
 
.gfg-horizontal-root .gfg-entry .gf-result .gf-spacer {
  float : left;
}
 
.gfg-horizontal-root .gfg-entry .gf-result .gf-spacer,
.gfg-horizontal-root .gfg-entry .gf-result .gf-relativePublishedDate {
  display : block;
  color: #AAAAAA;
}
 
.gfg-branding {
  white-space : nowrap;
  overflow : hidden;
  text-align : left;
  position : absolute;
  right : 0px;
  top : 0px;
  width : 80px;
}
 
.gfg-collapse-open, .gfg-collapse-closed {
  background-repeat : no-repeat;
  background-position : center;
  cursor : pointer;
  float : right;
  width : 17px;
  height : 20px;
}
 
.gfg-collapse-open {
  background-image : url('arrow_open.gif');
}
 
.gfg-collapse-closed {
  background-image : url('arrow_close.gif');
}
 
.gfg-collapse-href {
  float : left;
}
 
.clearFloat {
  clear : both;
}
  </style>
 
  <script type="text/javascript">
    function LoadDynamicFeedControl() {
      var feeds = [
	{title: 'Google Noticias',
	 url: 'http://news.google.es/news?pz=1&cf=all&ned=es&hl=es&topic=h&num=3&output=rss'
	}];
      var options = {
        stacked : false,
        horizontal : false,
		numResults : 16,
        displayTime : 5000,
        title : "---NOTICIAS---"
      }
 
      new GFdynamicFeedControl(feeds, 'feed-control', options);
    }
    // Load the feeds API and set the onload callback.
    google.load('feeds', '1');
    google.setOnLoadCallback(LoadDynamicFeedControl);
  </script>
<!-- ++End Dynamic Feed Control Wizard Generated Code++ -->
 
</body>
</html>

Second step: Upload your custom php file to $vulletinpath/modules/. Mine is named google_news.php

Third step:Create a new vbAdvanced PHP module
Just go to your VBulletin’s AdminCP > vBa CMPS > Add Module. Fill in the form and select the google_news.php file.

Last step: go to your VBulletin’s AdminCP > vBa CMPS > Edit pages. Select “Homepage” and add the module to left, center or right column.

Enjoy!