MyBB Community Forums

Full Version: [img] tag error request
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there a way to return an error when a user on my boards tries to use [img] tags? I have the tag off on my boards, but I'd like to let them know why the [img] tags aren't working.

maybe return an error message to them like this:
Sorry, but these boards require that you upload all photos as an attachment rather than using [img]...[/img] tags. The only time an img tag can be used is when you're using your signature.
You can do this by editing inc/datahandlers/post.php
Find:
		// And if we've got a minimum message length do we meet that requirement too?
		else if(my_strlen($post['message']) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && is_moderator($post['fid'], "", $post['uid']) != "yes")
		{
			$this->set_error("message_too_short", array($mybb->settings['minmessagelength']));
			return false;
		}
Add after:
		else if(preg_match('#\[img\].*?\[/img\]#si', $post['message']))
		{
			global $lang;
			$lang->postdata_no_img_error = 'Sorry, but these boards require that you upload all photos as an attachment rather than using [img]...[/img] tags. The only time an img tag can be used is when you\'re using your signature.';
			$this->set_error('no_img_error');
			return false;
		}
Haven't actually tested it so post back if it doesn't work.
perfect, ty.