MyBB Hacks

Full Version: Html or MyCode in Custom Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
*TO OP*

Open inc/functions_post.php, find:

PHP Code:
	    $post[$post_field] = htmlspecialchars_uni($field_value);


Replace:

PHP Code:
		// EDITING...
		//Comma separated list of groups ALLOWED to use bbcode, html, etc...
		$groups = '3,4,6'; // Empty to disable.

		$groupss = explode(',', $groups);
		if(empty($groups) || !in_array($post['usergroup'], $groupss))
		{
			// 0 = NO, 1 = YES
			$parseroptions = array(
				'allow_html' => 0,
				'allow_mycode' => 1,
				'allow_smilies' => 1,
				'allow_imgcode' => 0,
				'allow_videocode' => 0,
				'filter_badwords' => 1
			);
			$post[$post_field] = $parser->parse_message($field_value, $parseroptions);
		}
		else
		{
			$post[$post_field] = htmlspecialchars_uni($field_value);
		}
		// EDITING...


Open member.php, find:

PHP Code:
$customfield['name'] = htmlspecialchars_uni($customfield['name']);


Replace:

PHP Code:
		// EDITING...
		//Comma separated list of groups id ALLOWED to use bbcode, html, etc...
		$groups = '3,4,6'; // Empty to disable.

		$groupss = explode(',', $groups);
		if(empty($groups) || !in_array($post['usergroup'], $groupss))
		{
			// 0 = NO, 1 = YES
			$parseroptions = array(
				'allow_html' => 0,
				'allow_mycode' => 1,
				'allow_smilies' => 1,
				'allow_imgcode' => 0,
				'allow_videocode' => 0,
				'filter_badwords' => 1
			);
			$customfieldval = $parser->parse_message($customfieldval, $parseroptions);
		}
		else
		{
			$customfield['name'] = htmlspecialchars_uni($customfield['name']);
		}
		// EDITING...


Comments are self explanatory. I din't tested BTW, that will be your job Tongue

thanks a million for your help Smile

I changed the files and got the error message:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\mybb\inc\functions_post.php on line 122

line 122 would be

Code:
if(empty($groups) || !in_array($post['usergroup'], $groupss);)

PHP Code:
if(empty($groups) || !in_array($post['usergroup'], $groupss);)


PHP Code:
if(empty($groups) || !in_array($memprofile['usergroup'], $groupss);)


Try to remove temove the last bracket from the above codes.

I already tried that, but the error message stays the same, even without the last brackets Frown
Oh, sorry. Try replacing the code above with:

PHP Code:
if(empty($groups) || !in_array($post['usergroup'], $groupss))


PHP Code:
if(empty($groups) || !in_array($memprofile['usergroup'], $groupss))

removing the semicolons changes the error message to
Parse error: syntax error, unexpected '=', expecting ')' in C:\xampp\htdocs\mybb\inc\functions_post.php on line 126

line 126 is

Code:
'allow_html' = 0;

God, my code is full of errors, please replace any ; after the 1/0 to , (comma).

PD: Fxed my code above.
no problem, thanks for your time Wink

i replaced the codes but the Parse error: syntax error, unexpected '=', expecting ')' in C:\xampp\htdocs\mybb\inc\functions_post.php on line 126 error message stays
There it is again, sorry about that, try it again (too much issues for something this simple).
now it works fine, thanks a lot for your help! Smile
Pages: 1 2
Reference URL's