Not Solved Allowing IMG code in member titles?
#1
Not Solved
Hi there! So, I'm using the myUserTitle plugin by flash.tato, and it works great for regular tags such as bold, italic, colour, etc., but it seems the img code isn't working in it. Is there any way it could be modified to include it, or am I just doing something wrong?

The only people allowed to give custom user titles are the administration, so I'm not worried about abuse in this case. Basically we're wanting little images for the sled dog teams beneath the member's basic user title (and I don't want to go with using additional group images, since the sled teams aren't groups).

The full code for it is here, if it helps!


<?PHP
/*
 * myUserTitle Plugin!
 * Author: flash.tato
 */

function myut_info()
{
	return array(
		"name"			=> "myUserTitle Plugin!",
		"description"	=> "Allows the use of MyCode within Custom UserTitles",
		"author"		=> "flash.tato",
		"authorsite"	=> "http://www.tatodev.host22.com",
		"version"		=> "0.6",
		"compatibility" => "14*,16*",
		"guid"			=> "e5004427c306534ed2af532b79de2fb8"
	);
}

function myut_is_installed()
{
	global $db;
	$query = $db->simple_select("settings", "gid", "name='myut_usergroups'");
	return $db->num_rows($query);
}

function myut_install()
{
	global $db;
	$query = $db->simple_select("settinggroups", "gid", "name='member'");
	$gid = $db->fetch_field($query, "gid");
	$setting_1 = array(
		'name' => 'myut_usergroups',
		'title' => 'Allow MyCode in Custom User Title',
		'description' => 'Comma-separated list of usergroups which can make use of this feature, groups with admin permissions are implicit, <b>leave it empty if you want every usergroup can use MyCode in User Title</b>',
		'optionscode' => 'text',
		'value' => '',
		'disporder' => 10,
		'gid' => $gid
	);
	$db->insert_query("settings", $setting_1);
	rebuild_settings();
}

function myut_uninstall()
{
	global $db;
	$db->delete_query("settings", "name = 'myut_usergroups'");
	rebuild_settings();
}

function myut_can_use($usergroup = "")
{
	global $mybb;
	if($mybb->settings['myut_usergroups'] == "")
		return true;
	else
	{
		$ugs = explode(",", $mybb->settings['myut_usergroups']);
		return in_array($usergroup, $ugs);
	}
}

$plugins->add_hook("datahandler_user_insert", "myut_handle_insert");
$plugins->add_hook("datahandler_user_update", "myut_handle_update");

function myut_handle_insert($userhandler)
{
	global $mybb;
	if(intval($mybb->user['cancp']) || myut_can_use($mybb->usergroup))
	{
		$parser = myut_parser();
		$userhandler->user_insert_data['usertitle'] = $parser->parse_mycode($userhandler->user_insert_data['usertitle'], array('allow_imgcode' => 0));
	}
}

function myut_handle_update($userhandler)
{
	global $mybb;
	if(intval($mybb->user['cancp']) || myut_can_use($mybb->usergroup))
	{
		$parser = myut_parser();
		$userhandler->user_update_data['usertitle'] = $parser->parse_mycode($userhandler->user_update_data['usertitle'], array('allow_imgcode' => 0));
	}
}

function myut_parser()
{
	global $parser;
	if(!is_object($parser))
	{
		require_once(MYBB_ROOT . "/inc/class_parser.php");
		$parser = new postParser();
	}
	return $parser;
}

?>
Reply
#2
Not Solved
array('allow_imgcode' => 0)

array('allow_imgcode' => 1)
[retired]
Reply
#3
Not Solved
EDIT: nvm, Wildcard's solution, which I didn't notice earlier, is more proper because allow_imgcode is 0 by default.
Reply
#4
Not Solved
EDIT: Got it to work, thank you Wildcard!

Another question, would I be able to allow a <BR> in this with the same plugin using mycode?
Reply
#5
Not Solved
Yes if you make a MyCode with this regex:

\[br\]

this replacement (ofc):

<br />

and then use [br] in posts or the user title field
[retired]
Reply
#6
Not Solved
Thank you so much. Admittedly I'm a bit new to this mycode thing. I got it, thank you! n_n
Reply
#7
Not Solved
Cool
[retired]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)