MyBB Community Forums

Full Version: "<" turn to "&amp;lt;" which turns to "&amp;amp;lt;"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I made it so you could use html in certain custom proile fields but the problem is that anything to make a tag (for instance the "<" and ">" symbols) turn into their ampersand version, and placing the ampersand version the in the first place just renders a longer ampersand code.

I need to fix this because there's a REASON I'm trying to use html there.

I've followed the advice given on this site's knowledge base, and this is where it put me. Anyone know how to rectify this?
(2012-11-25, 03:46 AM)WitherBones Wrote: [ -> ]I made it so you could use html in certain custom proile fields

How did you make it so?

Is there a setting, did you make a plugin, or what? If it's a plugin, you either htmlspecialchars() one time too many or (if MyBB does that) you need to do the reverse unhtmlspecialchars()...
I'm trying to find the .doc on here where I found how to do it but it basically said to add something to your php in inc>functions_post.php

add:
		$post['fid2'] = htmlspecialchars_uni($post['fid2']);
above:
		eval("\$post['user_details'] = \"".$templates->get("postbit_author_user")."\";");
so what I get is:
		$post['fid2'] = htmlspecialchars_uni($post['fid2']);
		$post['fid12'] = htmlspecialchars_uni($post['fid12']);
		$post['fid13'] = htmlspecialchars_uni($post['fid13']);
		$post['fid14'] = htmlspecialchars_uni($post['fid14']);
		$post['fid15'] = htmlspecialchars_uni($post['fid15']);
		$post['fid16'] = htmlspecialchars_uni($post['fid16']);
		$post['fid19'] = htmlspecialchars_uni($post['fid19']);
		$post['fid20'] = htmlspecialchars_uni($post['fid20']);
		$post['fid21'] = htmlspecialchars_uni($post['fid21']);
		$post['fid22'] = htmlspecialchars_uni($post['fid22']);
		$post['fid23'] = htmlspecialchars_uni($post['fid23']);
		$post['fid17'] = htmlspecialchars_uni($post['fid17']);
		$post['fid24'] = htmlspecialchars_uni($post['fid24']);
		eval("\$post['user_details'] = \"".$templates->get("postbit_author_user")."\";");


Link to the instruction at the bottom: [link]
htmlspecialchars is what turns < into &lt; and & into &amp; that's what it does, escape HTML. Says so on the page you linked too.
so how do I make it so it DOES use the html? That was the original question. Cause without any edits at all, if just shows it like a code would.
Remove the htmlspecialchars() you posted above.

If that is not enough (i.e. < shows up as < instead of being interpreted as HTML) you will have to use htmlspecialchars_decode() instead. Or find the location of the htmlspecialchars() that does escape the < in the first place and remove that.
that worked great c: thank you