MyBB Community Forums

Full Version: Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I'm trying to connect my plugin to a CPF and it won't work, here's the code:

<?php



// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

function show_country_info()
{
	return array(
		'name'			=> 'Show Country',
		'description'	=> 'A plugin that shows the country of a user, this effects postbit template.',
		'website'		=> 'http://www.setupwith.us',
		'author'		=> 'Daniel Watts',
		'authorsite'	=> 'http://www.setupwith.us',
		'version'		=> '0.1',
		"guid" 			=> "",
		"compatibility" => "*"
	);
}

function show_country_activate()
{
	global $mybb, $templates;

	require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("postbit_author_user", '#inglevel\']}#', 'inglevel\']}<br />Country: <img src="images/{$post['fid5']}">');
		
	    	rebuild_settings();
		
}
function show_country_deactivate()
{
	global $mybb, $templates;

	require "../inc/adminfunctions_templates.php";
	find_replace_templatesets("postbit_author_user", '#<br />Country: Country: <img src="images/{$post['fid5']}#', '',0);
    	
		
		rebuild_settings();

}

?>

I get error on my site around here:
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit_author_user", '#inglevel\']}#', 'inglevel\']}<br />Country: <img src="images/{$post['fid5']}">');

Can anyone help me please?
You need to escape "fid5" Smile

    require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
    find_replace_templatesets("postbit_author_user", '#inglevel\']}#', 'inglevel\']}<br />Country: <img src="images/{$post[\'fid5\']}">');