MyBB Community Forums

Full Version: what is wrong with this template find/replace code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This does not work for some reason.

include MYBB_ROOT.'/inc/adminfunctions_templates.php';

find_replace_templatesets('usercp_options', '#'.preg_quote('<legend><strong>{$lang->other_options}</strong></legend>
<table cellspacing="0" cellpadding="2">').'#', "<legend><strong>{\$lang->other_options}</strong></legend>
<table cellspacing=\"0\" cellpadding=\"2\">
{\$wordfilter_usercp}");
Should probably be this:

include MYBB_ROOT.'/inc/adminfunctions_templates.php';

find_replace_templatesets('usercp_options', '#'.preg_quote('<legend><strong>{$lang->other_options}</strong></legend>
<table cellspacing="0" cellpadding="2">').'#si', "<legend><strong>{\$lang->other_options}</strong></legend>
<table cellspacing=\"0\" cellpadding=\"2\">
{\$wordfilter_usercp}");

thanks, didn't help
Hrm, I don't recall every doing a multi-line replacement like that...

You didn't forget:
require MYBB_ROOT."inc/adminfunctions_templates.php";

Did you? Wink
Most probably there is a line break which is not find and replacing it, try this;
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("usercp_options", "#".preg_quote('<legend><strong>{$lang->other_options}</strong></legend><table cellspacing="0" cellpadding="2">')."#i", '<legend><strong>{$lang->other_options}</strong></legend><table cellspacing="0" cellpadding="2">{\$wordfilter_usercp}');
thanks, i'll try the no break version, but i hate how it makes the templates look, but as long as it works....