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.
Options

How to make "Why do you want to join?" not required?

Hi,

I have version 2.0.18.10 of the forum and Approval registration method.
I need Why do you want to join? field but it's not required in my case.

I tried to edit class.usermodel.php:2348 where is ValidateSpamRegistration() method but it doesn't work when I return true or self::REDIRECT_APPROVE;

Is there any other file which I should edit to make this field not required?

PS. I don't want to change my method to basic

Best Answer

Answers

  • Options
    hgtonighthgtonight ∞ · New MVP
    edited July 2014

    The Discovery Text is required via the entry controller.

    You could hide the form input and put in some default text, or you could remove the requirement on the controller.

    Copy the file from /applications/dashboard/views/entry/registerapproval.php to your theme's view folder at /themes/YourThemeName/views/entry/. (If the views/entry/ folders don't exist in your theme, make them).

    Open up the copied file at /themes/YourThemeName/views/entry/registerapproval.php and remove the following lines:

    <li>
      <?php
        echo $this->Form->Label('Why do you want to join?', 'DiscoveryText');
        echo $this->Form->TextBox('DiscoveryText', array('MultiLine' => TRUE));
      ?>
    </li>
    

    Then, at line 2, add the following line:

    <?php $this->Form->AddHidden('DiscoveryText', 'This is placeholder text to appease the validation process. Totes not spam!', TRUE); ?>
    

    Your approval form should no longer show the 'Why do you want to join?' box.

    P.S. You should upgrade to 2.0.18.11.

    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.

  • Options
    peregrineperegrine MVP
    edited July 2014

    if you upgrade to 2.1 - you can avoid copying views which can lead to issues on upgrades with stale view code.
    example of stale code in one plugin - e.g. http://vanillaforums.org/discussion/27510/make-firstlastnames-work-

    then in 2.1

    all you need is a plugin with this function

        public function EntryController_RegisterValidation_Handler($Sender) {
     $Sender->Form->SetFormValue('DiscoveryText', $Value = "no discoverytext entered");
            }
    

    and css to hide the form entry.

    #Form_DiscoveryText {
        display: none;
    }
    

    and a definition to replace discoverytext label.

    $Definition['Why do you want to join?'] = "";

    I think its cleaner. And since 2.0.18.x will be no longer supported - you might as well move to 2.1.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Unfortunately both solutions didn't solve my problems. I don't want to hide or remove this field. I want to keep it but not force users fill it.

    Is there any other solution which will allow me to achieve that?

  • Options

    probably either set a value first or set a value if user didn't

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Where can I do it? I mean not provide any text to the front end and just fill it after sending registration form? Or skip validation of this field?

  • Options

    Thank! That's great :)

Sign In or Register to comment.