Hook build_forumbits_forum and Templates
#2
You'll need to globalise $wanted_index, and I think escape some characters in the eval itself:

function wanted_index(&$forum)
{
	global $mybb, $db, $templates, $wanted_index;

	...
	eval("\$wanted_index = \"".$templates->get('wanted_index')."\";");
}

See if that works.

The reason this breaks and causes a 500:

eval('$forum['wanted_index'] = "'.$templates->get('wanted_index').'";');

is because you're using single quotes in the eval, and in the array key, so it closes the quotes and would result in a parse error. If you do it that way, you need to escape them, or use double quotes:

eval("\$forum['wanted_index'] = \"".$templates->get('wanted_index')."\";");

or:

eval('\$forum[\'wanted_index\'] = "'.$templates->get('wanted_index').'";');
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply


Messages In This Thread
RE: Hook build_forumbits_forum and Templates - by Matt - 2021-08-22, 07:50 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)