Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Disable the Body is required message.
smoigecom
New
Comments
and the post will appear with just a space in it (pretty much blank).This could also be done with some javascript by binding to the submit event and checking if the form is empty.
This is definitely a very hacky way round and editing the core to remove one line would probably be the way forward
In
applications/vanilla/models/class.discussionmodel.php
go to line
516: $this->Validation->ApplyRule('Body', 'Required');
and comment it out:
// Add & apply any extra validation rules:
$this->Validation->ApplyRule('Body', 'Required');
$MaxCommentLength = Gdn::Config('Vanilla.Comment.MaxLength');
if (is_numeric($MaxCommentLength) && $MaxCommentLength > 0) {
$this->Validation->SetSchemaProperty('Body', 'Length', $MaxCommentLength);
$this->Validation->ApplyRule('Body', 'Length');
}
I found the code that you were talking about ... but commenting out the body required doesn't do anything. I still get the Body is required message. Any other thoughts?
You still need to comment out the Body required thing above
$this->Validation->ApplyRule('Body', 'Required');
(you dont need to comment out the length ones).And then all you have to do now is:
Go to applications/vanilla/settings/structure.php Line 53:\
Change
->Column('Body', 'text', FALSE, 'fulltext')
To
->Column('Body', 'text', TRUE, 'fulltext')
Then just disable and re-enabled vanilla from the dashboard.
Fatal error: Class 'CategoryModel' not found in /home/content/c/i/p/cip6791/html/_domains/smoige.com/plugins/Categories2Menu/class.categories2menu.plugin.php on line 80
I had problems with the File Upload plugin as well. It was giving me the same problem. After deleting plugin folders and uploading them back ... i got the forum to work in a way. I can do anything, but visit a post. I get the Bonk message. What should I do? Reinstall? I ll leave it the way it is for now, maybe you can help me figure out what is wrong. I would really want to keep everything I have and still use Vanilla.
Thank you.
Hi,
I know this is an old thread but I'd like to do the same thing (make Body be optional) for the same reason -- but without modifying core files.
@garymandell mentioned you might be able to hook in to the form and substitute an empty body for a body with an empty space character. I tried that but no success yet. Here's the code:
But this doesn't work -- it still says "Body is required".
Any ideas?
Thanks,
David
When the event "BeforeSaveDiscussion" is fired, there is no such thing as a discussion, so it couldn't be (and isn't) passed in the EventArguments. Instead all you at this point in time are some form values. So your code should look like that:
Do you mind sharing why an empty body is needed? Just curious...
@davidnhutch
Create a plugin that modifies the structure of the discussion and comment table to make the body column nullable. That will remove the requirement from the schema automatically:
When enabled, this plugin should remove the requirement.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight: are you sure? DiscussionModel has that code:
So I'd say independently from the scheme, the "Required" validation will happen.