[WIP][Pending Approval] Modify Linktree

Started by Hj Ahmad Rasyid Hj Ismail, July 20, 2014, 06:23:48 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Modify Linktree Mod

I making a simple mod that does the following:
   (a) Remove the line above linktree;
   (b) Put the linktree in a square box overiding the above;
   (c) Put the linktree in a round box overiding all of the above;
   (d) Hide the forum name in the linktree;
   (e) Hide the category name in the linktree.
   (f) Hide the whole linktree in index / frontpage only;
   (g) Hide the whole linktree everywhere completely.You can test it in lower SMF 2.0 version too as IMO it should work just fine. ;)

I have resolve the problem below.

I attached its package for anyone interested to test it pending its approval.


RESOLVED. Capital S should be used instead lower case s in $modSettings. :P

QuoteI am modifying the linktree so that it could hide either forum name or categories with the following mods.

Removing forum name:
Find:
array_unshift($context['linktree'], array(
'url' => $scripturl,
'name' => $context['forum_name_html_safe']
));

Replace With:
// Modify Linktree Mod Starts
if (empty($modsettings['mlt_hide_name']))
{
array_unshift($context['linktree'], array(
'url' => $scripturl,
'name' => $context['forum_name_html_safe']
));
}


Removing forum categories:
Find:
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $scripturl . '#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);

Replace With:
// Modify Linktree Mod Starts
if (!empty($modsettings['mlt_hide_cat']))
{
$context['linktree'] = array_merge(
$context['linktree'],
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);
} else {
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $scripturl . '#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);
}


Simple removal did work but unfortunately, the above mods did not work. Any idea why the mods did not work?

Morsyl

Variable names are case sensitive, so perhaps it's because you are checking $modsettings instead of $modSettings ?

Hj Ahmad Rasyid Hj Ismail

#2
Quote from: Morsyl on July 21, 2014, 08:28:48 AM
Variable names are case sensitive, so perhaps it's because you are checking $modsettings instead of $modSettings ?

I am getting older. Thank you for noting that. Really appreciated.

This topic name is changed since the package is already sent for SMF Customization Team approval.

Its package is attached in the first post for testing pending its approval.


Hj Ahmad Rasyid Hj Ismail

This mod is approved. Details are as follows:
1. Support Topic
2. Mod Link

I am locking this topic.

Advertisement: