7
I recalled a similar issue I dealt with in my
chess module by having the submit link only in the main menu, and placing code in the module's xoops_version.php so that the link is only shown to authorized users.
Here's the relevant code.
...
$modversion['sub'][2]['name'] = _MI_CHESS_SMNAME2;
$modversion['sub'][2]['url'] = 'index.php';
// Conditional menu items
global $xoopsModule, $xoopsModuleConfig, $xoopsUser;
if (is_object($xoopsModule) and $xoopsModule->getVar('dirname') == 'chess') {
// Display create-game menu item if current user has the play-chess right.
if (!empty($xoopsModuleConfig['groups_play']) and is_array($xoopsModuleConfig['groups_play'])
and (
in_array(XOOPS_GROUP_ANONYMOUS, $xoopsModuleConfig['groups_play'])
or (
is_object($xoopsUser) and count(array_intersect($xoopsUser->getGroups(), $xoopsModuleConfig['groups_play'])) > 0
)
)
)
{
$modversion['sub'][3]['name'] = _MI_CHESS_SMNAME3;
$modversion['sub'][3]['url'] = 'create.php';
}
// Display ratings menu item if ratings system is enabled.
if ($xoopsModuleConfig['rating_system'] != 'none') {
$modversion['sub'][4]['name'] = _MI_CHESS_SMNAME4;
$modversion['sub'][4]['url'] = 'ratings.php';
}
// Display my-games menu item if current user is logged in.
if (is_object($xoopsUser)) {
$modversion['sub'][5]['name'] = _MI_CHESS_SMNAME5;
$modversion['sub'][5]['url'] = 'player_stats.php?player_uid=' . $xoopsUser->getVar('uid');
}
}
...