SimplePortal
Customization => Blocks and Modifications => Block Requests => Topic started by: EvilGeneral on October 07, 2011, 01:05:07 PM
-
Can anyone help me updating this block to work with SMF 2.0?
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $user_info, $db_prefix;
$block_parameters = array(
'num_children' => 'int',
);
if ($return_parameters)
return $block_parameters;
$child_depth = !empty($parameters['num_children']) ? (int) $parameters['num_children'] - 1 : -1;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
// Remobe any boards this user can't actually see.
$temp_boards = $boards;
$request = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE !($user_info[query_see_board])", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
unset($temp_boards[$row['ID_BOARD']]);
mysql_free_result($request);
echo '
<div style="padding-left:2px;">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
foreach ($boardList[$catid] as $boardid)
{
$prefix = '';
for ($i=0; $i<=$boards[$boardid]['level']; $i++)
$prefix .= '-';
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
}
echo '
</div>';
-
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $user_info, $smcFunc;
$block_parameters = array(
'num_children' => 'int',
);
if ($return_parameters)
return $block_parameters;
$child_depth = !empty($parameters['num_children']) ? (int) $parameters['num_children'] - 1 : -1;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
// Remove any boards this user can't actually see.
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE ' . !($user_info['query_see_board']),
array()
);
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
echo '
<div style="padding-left: 2px;">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
foreach ($boardList[$catid] as $boardid)
{
$prefix = '';
for ($i = 0; $i <= $boards[$boardid]['level']; $i++)
$prefix .= '-';
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
}
echo '
</div>';
-
Many thanks, Veridis.
But i've got this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
Arquivo: /public_html/forum/Sources/PortalBlocks.php(3351) : eval()'d code
Linha: 22
;)
-
Ah, sorry about that. Forgot it was changed in 2.0.
Try this instead:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $user_info, $smcFunc;
$block_parameters = array(
'num_children' => 'int',
);
if ($return_parameters)
return $block_parameters;
$child_depth = !empty($parameters['num_children']) ? (int) $parameters['num_children'] - 1 : -1;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
// Remove any boards this user can't actually see.
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE {query_see_board}',
array(
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
echo '
<div style="padding-left: 2px;">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
foreach ($boardList[$catid] as $boardid)
{
$prefix = '';
for ($i = 0; $i <= $boards[$boardid]['level']; $i++)
$prefix .= '-';
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
}
echo '
</div>';
-
That {query_see_board} really works?
-
Should work
-
Should work
There is a problem with access permissions.
Guest users are viewing all forum sections.