2013-08-12, 03:43 AM
Hello,
I'm currently in the process of developing a plugin that will allow me to change which forumbit templates are used for my forums based on a specific forum setting.
Essentially, my forums can be checked as either "A" or "B". I'm trying to hook into the functions_forumlist to change the $forum_list eval so get $templates->forumbit_a_ or $templates->forumbit_b.
Trying to just change the eval with an if/else statement doesn't seem to work, nor can I get access to the $forumcat or $depth variables to tack a prefix on to those.
Here's the code:
I have been able to accomplish this by directly editing the functions_forumlist.php file, but I wanted to see if I could make it a plugin instead.
Thanks in advance for any help.
I'm currently in the process of developing a plugin that will allow me to change which forumbit templates are used for my forums based on a specific forum setting.
Essentially, my forums can be checked as either "A" or "B". I'm trying to hook into the functions_forumlist to change the $forum_list eval so get $templates->forumbit_a_ or $templates->forumbit_b.
Trying to just change the eval with an if/else statement doesn't seem to work, nor can I get access to the $forumcat or $depth variables to tack a prefix on to those.
Here's the code:
$plugins->add_hook("build_forumbits_forum", "plugin_forumbits");
function plugin_forumbits($forum)
{
global $mybb, $templates;
if($forum['type_a'] == 1) {
eval("\$forum_list .= \"".$templates->get("forumbit_depth$depth$forumcat_a")."\";");
}
else {
eval("\$forum_list .= \"".$templates->get("forumbit_depth$depth$forumcat")."\";");
}
}
I have been able to accomplish this by directly editing the functions_forumlist.php file, but I wanted to see if I could make it a plugin instead.
Thanks in advance for any help.