MyBB Community Forums

Full Version: Template edits
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do you make template edits in mybb?

In the normal postbit and classic postbit I would like to add
Quote:User ID: {$post['uid']} <br />
beneath the usertitle when the plugin is activated.
Go to: ACP > Templates > Postbit Templates > Open "postbit" and "postbit_classic" templates and and find {$post['usertitle']} and add the following code just after that;
UserID: {$post['uid']}
No, I need the code so that when I activate my plugin it makes this template edit.
Try this;

	require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", "#".preg_quote('{$post[\'usertitle\']}')."#i", '{$post[\'usertitle\']}<br/>UserID: {$post[\'uid\']}');
Thanks! and how to remove on uninstall?
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("postbit", "#".preg_quote('<br/>UserID: {$post[\'uid\']}')."#i", '', 0);