Hello,
the function i mean does already exist in the usercp(screenshot). I want to display the subscribed forums on a different page.
PHP Code:
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'custom_favoriten');
define('CSRF_PROTECTION', true);
define('CONTENT_PAGE', false);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('user', 'infractionlevel');
// get special data templates from the datastore
$specialtemplates = array(
'iconcache',
'noavatarperms',
'smiliecache',
'bbcodecache',
);
// pre-cache templates used by all actions
$globaltemplates = array(
// subscribed forums templates
'forumhome_forumbit_level1_post',
'forumhome_forumbit_level1_nopost',
'forumhome_forumbit_level2_post',
'forumhome_forumbit_level2_nopost',
'forumhome_subforumbit_nopost',
'forumhome_subforumbit_post',
'forumhome_subforumseparator_nopost',
'forumhome_subforumseparator_post',
'forumhome_lastpostby',
'forumhome_moderator',
'forumhome_markread_script',
'forumdisplay_loggedinuser'
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_forumlist.php');
require_once(DIR . '/includes/functions_user.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
($hook = vBulletinHook::fetch_hook('custom_favorites')) ? eval($hook) : false;
cache_ordered_forums(1, 0, $vbulletin->userinfo['userid']);
$show['forums'] = false;
foreach ($vbulletin->forumcache AS $forumid => $forum)
{
if ($forum['subscribeforumid'] != '')
{
$show['forums'] = true;
}
}
if ($show['forums'])
{
if ($vbulletin->options['showmoderatorcolumn'])
{
cache_moderators();
}
else
{
cache_moderators($vbulletin->userinfo['userid']);
}
fetch_last_post_array();
$show['collapsable_forums'] = true;
$forumbits = construct_forum_bit(-1, 0, 1);
$forumhome_markread_script = vB_Template::create('forumhome_markread_script')->render();
if ($forumshown == 1)
{
$show['forums'] = true;
}
else
{
$show['forums'] = false;
}
}
$templater = vB_Template::create('custom_favoriten');
$templater->register('forumbits', $forumbits);
$templater->register('forumhome_markread_script', $forumhome_markread_script);
print_output($templater->render());
I created a custom hook in my template custom_favorites in the hook xml to get the code at the right position in my template.
maybe there is an easier way to get the function into a custom template or even do it without a custom template.
regards
chris