Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Forcing users to choose a category

whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
My original question was answered most helpfully by Lincoln here:

http://vanillaforums.org/discussion/16672/can-i-force-users-to-choose-a-category-in-vanilla-2#Item_6

but this fix no longer works with the latest version of Vanilla.
In /views/post/discussion.php (copy it from Vanilla app into your theme if you haven't yet) find this:
echo $this->Form->DropDown('CategoryID', $this->CategoryData, array('TextField' => 'Name', 'ValueField' => 'CategoryID'));
And replace with:
echo $this->Form->DropDown('CategoryID', $this->CategoryData, array('IncludeNull' => TRUE, 'TextField' => 'Name', 'ValueField' => 'CategoryID'));
The new line is slightly different:

echo $this->Form->CategoryDropDown('CategoryID', array('Value' => GetValue('CategoryID', $this->Category)));

Lincoln's fix meant that users had to explicitly choose a category, and was very helpful for our site.

Could someone tell me how to alter the new code (assuming it is possible).

Cheers as always to anyone who can help.
Tagged:

Best Answer

Answers

Sign In or Register to comment.