MyBB Community Forums

Full Version: [php]str_replace function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am learning how to make a plugin for MyBB.
How do i use the function str_replace to look for this:
<td><input type="text" class="textbox" name="usertitle" size="25" maxlength="{$mybb->settings['customtitlemaxlength']}" value="{$newtitle}" /></td>
I keep getting errors.I guess the code is too complex. It worked with texts like:
{$lang->new_custom_usertitle}
Any alternate solutions are welcome.
Regards
You probably have a syntax issue or similar. You should post the actual code you're using.
if(!$templates->cache['modcp_editprofile']) $templates->cache('modcp_editprofile');
				$templates->cache['modcp_editprofile'] = str_replace('{$lang->new_custom_usertitle}', "
				<p>I will not allow Title change</p>", $templates->cache['modcp_editprofile']);
The code above replaces 'New Custom User Title: (leave blank to use existing)' with my codes

How would i replace the box with my codes?
[attachment=17817]
Sorry for late reply, i had problems with my localhost
I managed to solve it.
	$templates->cache['modcp_editprofile'] = str_replace('											<td><input type="text" class="textbox" name="usertitle" size="25" maxlength="{$mybb->settings[\'customtitlemaxlength\']}" value="{$newtitle}" /></td>', "",$templates->cache['modcp_editprofile']);