News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Removing Character Check on Message Body

Started by shempsall, February 14, 2011, 04:22:27 AM

Previous topic - Next topic

shempsall

Hi all,

I'm trying to remove the Character Check on Message Body so members can post without entering anything in the message box.

The reason I doing this is because there is a couple of threads Where I just want them to upload images and not have anything else on there.

I have already tried to remove the message box itself but it still says :
"The following error or errors occurred while posting this message:
The message body was left empty."

How do I get by this?

Thanks

Arantor

It would require ripping the code out of multiple places in Post.php and modifying the bbc and smiley parsing routines to not throw a wobbly on empty content - and that's just off the top of my head (it will also screw up feeds, notifications and a few other things that expect there to be content in the post body.

shempsall

Well it shouldn't mess up the other stuff you have mentioned has I have cloned the Post.php, Sub-Posts.php and Post.template.php

all the stuff you have mention run off them files and have created other files and they work so far. I'm just struggling to remove the Check to see if there is content in the box.

Where abouts in the Post.php file should I be looking?

Arantor

Look for $_POST['message']

So you've tried all those other areas with empty posts and they work fine? Or at least don't fail spectacularly? What about in wireless modes?

shempsall


Arantor

SMF has 3 wireless access modes, WAP, imode and WAP2 for use on smartphones. Mind you, none of them handle attachments IIRC, so you just get a lot of pointless empty space... (see the footer for WAP2 link for an example)

shempsall

Ah right,

This site is not for Phones etc... So I don't need to worry about that.


Arantor

You should at least remove the link from the footer though. And RSS feeds still won't work that well either...

shempsall

Yeah I will do.

Also looking at the Post.php

I think it has something to do with this.

      if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
         $post_errors[] = 'no_message';

If I remove it I just get an Error.

Arantor


shempsall


	
	
// Let's see if there's still some content left without the tags.
	
	
if (
$smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
	
	
	
$post_errors[] = 'no_message';
	
}
	
if (isset(
$_POST['calendar']) && !isset($_REQUEST['deleteevent']) && $smcFunc['htmltrim']($_POST['evtitle']) === '')
	
	
$post_errors[] = 'no_event';
	
// You are not!
	
if (isset(
$_POST['message']) && strtolower($_POST['message']) == 'i am the administrator.' && !$user_info['is_admin'])
	
	
fatal_error('Knave! Masquerader! Charlatan!'false);

Arantor

OK, so just removing those two lines shouldn't give you an error, but I don't know what error you got so I can't help debug it...

shempsall

All it says is : "An Error as Occurred"

but I have found out if I remove all the :       

$post_errors[] = 'no_message';

Then I get the above Error.

Arantor

Ah, yes, the joys of the text column in the database. It really doesn't like being given an empty value, which is almost certainly what the error is telling you.

Try turning on database query errors being logged in the error log (Admin > Security and Moderation IIRC) and see what query is logged in the error log with the 'An Error Has Occurred' scenario.

shempsall

I'm getting quite a few

Here they all are :

/index.php?action=uploadcovers2;start=0;board=18: Undefined index: uploadcoversWaitTime_brokenFile: /forum/Sources/Errors.php
Line: 206

/forum/index.php?action=uploadcovers2;start=0;board=1
Unable to load the 'Uploadcovers.english' language file

/forum/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /forum/Themes/default/Uploadcovers.template.php (main sub template - eval?)
Line: 504

/forum/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /forum/Themes/default/Uploadcovers.template.php (main sub template - eval?)
Line: 222

/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /forum/Themes/default/Uploadcovers.template.php (main sub template - eval?)
Line: 119

/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /forum/Themes/default/Uploadcovers.template.php (main sub template - eval?)
Line: 73

/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /forum/Sources/Uploadcovers.php
Line: 1016

/index.php?action=uploadcovers;board=1.08: Undefined index: uploadcoversFile: /forum/Sources/Uploadcovers.php
Line: 759

/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile: /Sources/Uploadcovers.php
Line: 178

/index.php?action=uploadcovers;board=1.08: Undefined index: make_eventFile:
/forum/Sources/Uploadcovers.php
Line: 106

/index.php?action=uploadcovers;board=1.0
Unable to load the 'Uploadcovers.english' language file

Arantor

Yes, you're not supposed to just modify Post and copy it into a new file without copying the language files and rewriting them to suit.

As a side thought, did you consider trying a gallery mod for the purposes of uploading cover images to? (now I get the vague idea where you're going with this...)

Advertisement: