MyBB Community Forums

Full Version: Hooks.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to replace the first with the second in a plugin i am working on in the functions_forumlist.php however the only hook i can find is just above the first quoted code. Any idea how to do it?

			// Build the link to this forum
			$forum_url = get_forum_link($forum['fid']);

			
				if (!$forum['linkto'])
			{
						$forum_url = get_forum_link($forum['fid']);
			} 
			else
			{
						$forum_url = "redirect.php?fid=".$forum['fid']."";
			}

At the moment I Have.

$plugins->add_hook('build_forumbits_forum', 'redirecthits');

function redirecthits()
{
	global $forum;
			// Build the link to this forum
			
				if (!$forum['linkto'])
			{
						$forum_url = get_forum_link($forum['fid']);
			} 
			else
			{
						$forum_url = "redirect.php?fid=".$forum['fid']."";
			}
}

In the plugin file, but it isn't working as it is above the $forum_url = get_forum_link($forum['fid']);
Might be easier to modify the templates rather than trying to override the $forum_url variable.
Yes i thought that, but where...because the only hook is above where the template is loaded.
Modify the template to use custom variables you set, and set them in the hook.
I've sorted it now, thanks Smile.