Users posting in categories/root
I found a few other threads with similar problems but none of them seemed to have the answer.
People are posting in "categories/root" (on purpose) which for some reason exists, and I can't find any way to lock it.
Is there any way to stop this?
I'm using vanilla 2.0.18.10
0
Answers
@Skynum
Welcome to the community.
In Dashboard, under Forum, have you set Categories to
There is no check in the DiscussionModel for CategoryID >=1 so if someone really wants to post to root category he can always spoof he http request. In order to prevent that, you would have to write a simple plugin:
public function DiscussionModel_BeforeSaveDiscussion_Handler($Sender) { $Sender->Validation->AddRule('NoRootCategoryID', 'regex:/^[1-9]\d*$/'); $Sender->Validation->ApplyRule('CategoryID', 'NoRootCategoryID', T('GOTCHA!')); }