Quantcast
Channel: Lecciones Prácticas » vBulletin
Viewing all articles
Browse latest Browse all 10

vBA news module customization (avoid topic links display)

$
0
0

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>

Viewing all articles
Browse latest Browse all 10

Trending Articles