Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Detecting type of form

I want to detect whether a form is DiscussionForm or CommentForm
For that I'm using this check
if($Context->SelfUrl == 'post.php') { if ($DiscussionForm->Form){} }

How do i get $DiscussionForm in there. Using global $DiscussionForm doesn't work
Using $DiscussionForm = $Context->ObjectFactory->CreateControl($Context, 'DiscussionForm');
creates a new control and hence the delegates I'm attaching to the DiscussionForm don't work anymore.


  • Options
  • Options
    Can you check for the php file instead like discussions.php?
  • Options
    discussions.php doesn't have self url in it.
    its not one of the root php pages. Its a theme file
  • Options
    What delegate are you using?

    I would think that DiscusssionForm_PreRender fires on discussion forms, and CommentForm_PreRender fires on comment forms.
This discussion has been closed.