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.

Bonk when trying to register

This discussion is related to the BotStop addon.
fh111fh111 Vanilla Padawan ✭✭
edited September 2012 in Vanilla 2.0 - 2.8

Hi there

we would love to use this plugin but unfortunately, we are getting a bonk when clicking on 'register'

i deactivated all other plugins but the problem resolves.

version being used is 2.0.18.4

anyone else running into this problem?

«1

Comments

  • fh111fh111 Vanilla Padawan ✭✭

    i found out why this happens. we are using approval method for registrations and in the plugin there is no file registerapproval.php in BotStop/views

    i created one and filled it with the code from the standard file found in applications/dashboard/views/entry
    removed the built in math question and added the relevant BotStop code

    it works now

  • nice plugin @brainache -

    nice work @fh111
    I implemented @fh111 's mod and it works great.

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

  • I got as far as creating an empty file named registerapproval.php. Could you please elaborate on:1) what is the standard file, 2) which lines did you remove exactly from where, 3) which code exactly did you add and 4) where did you add it?

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited April 2013

    @marksch

    Check out the edit @peregrine suggests here: http://vanillaforums.org/discussion/comment/167592/#Comment_167592

    I followed them and it works fine.

  • Where do I find class.BotStop.plugin.php?

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @marksch

    It needs to be in the plugins/BotStop folder.

    You may need to create it, and then add in what @peregrine suggests.

    UnderDog
  • I believe that's not an answer to my question. Please, explain if you think I'm wrong.

  • peregrineperegrine MVP
    edited April 2013

    I believe that's not an answer to my question. Please, explain if you think I'm wrong.

    try searching the add-ons for botstop or follow the links that were suggested - its not that hard. then unzip it in the unzipped plugin , you will find it there. follow the links that whu606 suggested.

    I got as far as creating an empty file named registerapproval.php. Could you please elaborate on:

    1) what is the standard file,

    applications/dashboard/views/entry/registerapproval.php

    copy it it into plugins/botstop views

    2) which lines did you remove exactly from where,

    http://vanillaforums.org/discussion/comment/167592/#Comment_167592
    of do what fh111 suggests.

    3) which code exactly did you add and

    see #2

    4) where did you add it?

    see #2

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

    UnderDog
  • My "class.BotStop.plugin.php" looks like this now:

    <?php if (!defined('APPLICATION')) exit(); public function UserModel_BeforeRegister_Handler($Sender) { $test = $Sender->EventArguments['User']['BotCheck']; $a1 = C('Plugins.BotStop.Answer1'); $a2 = C('Plugins.BotStop.Answer2'); $randnumber = $Sender->EventArguments['User']['BotResult']; // test for random question if ($randnumber != $test) // unrandomized answer one and two commented out // if ($test != $a1 && $test != $a2) { $Sender->Validation->AddValidationResult('BotCheck',T('Your humanity is suspect... Please try again.')); $Sender->EventArguments['Valid'] = FALSE; } // return FALSE; } ?>

    This does not work though, any idea what I did wrong? (I created the registerapproval.php and the language definitions, but I suspect that I did not copy & paste the right portions of the code?

    Thanks in advance, Robert

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @rkneschke

    My working one looks like this, so it looks like you missed something!

    <?php if (!defined('APPLICATION')) exit();
    
    // Define the plugin:
    $PluginInfo['BotStop'] = array(
       'Description' => 'Adds a question designed to stop bots from registering',
       'Version' => '1.0.1',
       'Author' => "David Massey",
       'AuthorEmail' => '[email protected]com',
       'AuthorUrl' => ''
    );
    
    
    class BotStop extends Gdn_Plugin 
    
    {
    
    public function Setup() 
            {
            SaveToConfig('Plugins.BotStop.Question', 'What is three plus three?');
            SaveToConfig('Plugins.BotStop.Answer1', '6');
            SaveToConfig('Plugins.BotStop.Answer2', 'six');
            }
    
    
        public function EntryController_Render_Before($Sender,$Args)
        {
            if(strcasecmp($Sender->RequestMethod,'register')==0)
            {
                if(strcasecmp($Sender->View,'registerthanks')!=0 && strcasecmp($Sender->View,'registerclosed')!=0)
                {
                    $RegistrationMethod = Gdn::Config('Garden.Registration.Method');
                    $Sender->View = $this->GetView( 'register'.strtolower($RegistrationMethod).'.php');
                }
            }
        }
    
                 public function UserModel_BeforeRegister_Handler($Sender)
                {
                $test = $Sender->EventArguments['User']['BotCheck'];
                $a1 = C('Plugins.BotStop.Answer1');
                $a2 = C('Plugins.BotStop.Answer2');
                $randnumber = $Sender->EventArguments['User']['BotResult'];
                // test for random question
                if ($randnumber != $test)
                // unrandomized answer one and two commented out
                // if ($test != $a1 && $test != $a2)
                {
                $Sender->Validation->AddValidationResult('BotCheck',T('Your humanity is suspect... Please try again.'));
                $Sender->EventArguments['Valid'] = FALSE;
                }
                // return FALSE;
                }
    
    
        public function Base_GetAppSettingsMenuItems_Handler($Sender)
        {
            $Menu = $Sender->EventArguments['SideMenu'];
            $Menu->AddItem('Forum', T('Forum'));
            $Menu->AddLink('Forum', T('BotStop'), 'settings/botstop', 'Garden.Settings.Manage');
        }
    
    
        public function SettingsController_BotStop_Create($Sender)
        {
    
            $Sender->Permission('Garden.Settings.Manage');
                    $Sender->Form = new Gdn_Form();
                    $Validation = new Gdn_Validation();
                    $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
                    $ConfigurationModel->SetField(array('Plugins.BotStop.Question','Plugins.BotStop.Answer1','Plugins.BotStop.Answer2',));
                    $Sender->Form->SetModel($ConfigurationModel);
            $Sender->Title('BotStop Plugin Settings');
            $Sender->AddSideMenu('settings/botstop');
    
        if ($Sender->Form->AuthenticatedPostBack() === FALSE) 
         {
         $Sender->Form->SetData($ConfigurationModel->Data);
         } 
         else 
         {
         $Data = $Sender->Form->FormValues();
         if ($Sender->Form->Save() !== FALSE) $Sender->StatusMessage = T("Your settings have been saved.");
         }
        $Sender->Render($this->GetView('settings.php'));
        }
    }
    
    ?>
    
    rkneschke
  • peregrineperegrine MVP
    edited October 2012

    @rkneschke said:
    My "class.BotStop.plugin.php" looks like this now:

    <?php if (!defined('APPLICATION')) exit(); public function UserModel_BeforeRegister_Handler($Sender) { $test = $Sender->EventArguments['User']['BotCheck']; $a1 = C('Plugins.BotStop.Answer1'); $a2 = C('Plugins.BotStop.Answer2'); $randnumber = $Sender->EventArguments['User']['BotResult']; // test for random question if ($randnumber != $test) // unrandomized answer one and two commented out // if ($test != $a1 && $test != $a2) { $Sender->Validation->AddValidationResult('BotCheck',T('Your humanity is suspect... Please try again.')); $Sender->EventArguments['Valid'] = FALSE; } // return FALSE; } ?>

    This does not work though, any idea what I did wrong? (I created the registerapproval.php and the language definitions, but I suspect that I did not copy & paste the right portions of the code?

    Thanks in advance, Robert

    as whu606 says you missed something. - you replaced all the code in class.BotStop.plugin.php with just the function. But you needed to leave the rest of the functions and code intact. ergo - cut and paste whu606's complete code with the function change for class.BotStop.plugin.php. as well as the other changes to other files discussed here.

    http://vanillaforums.org/discussion/comment/168659/#Comment_168659

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

  • @whu606 and peregrine.

    Thanks! Now it works.

    I was not able to get a german language-definitions to work, so I just hardcoded my translation in the "registerapproval.php". The language definitions are nut sufficient anyway, because the operators (and, times) are not translatable there.

    Thanks,
    Robert

  • I'm posting here, because here is where I started looking for answers. I had BotStop running with Register approval enabled. Found out everyone was getting the "BONK". So I came here and followed all the copy paste directions,etc. This is not as easy as I'd hoped. Well, after doing everything, I had an error on 83 of the class.BotStop.plugin.php. Saw that: <?php if (!defined('APPLICATION')) exit(); didn't have the closing ?> , but when I added it, all the coding now appears at the top of my forums: www.metaldetectingoregon.com/forums/index.php

    The forum came back up but with coding showing.

    So now I'm testing the new BotStop sign in with the coding showing and guess what? It accepts any answer. I can put any answer in there and it accepts it. Man this stuff shouldn't be this hard.

    Any help? Thanks.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2013

    Did you create the new folder registerapproval.php ? copy the code in the discussion by peregrine? did you copy the code that replaces the function at the begining of the
    class.BotStop.plugin.php ?

    the kind of error you are getting is from something pasted wrong, a missing coma an extra coma you must do it carefully.

    Saw that: <?php if (!defined('APPLICATION')) exit(); didn't have the closing ?>

    it is not supposed to have that in the end to close it.

    The error message tells you what line the error is at

  • peregrine ☯ MVP

    October 2012

    I've cut and pasted it and it works for me. verify if the definitions.php, registerapproval.php, and class.BotStop.plugin.php

    all have

    <?php if (!defined('APPLICATION')) exit(); ?>
    

    or try starting over and cutting and pasting.

    I put the ?> in as instructed by peregrine

    If I don't put the ?> in the above line, no one can access the forums. And I get an error in line 83, which doesn't help me much as there's nothing there except a ")", i think. I'm not a coder, by I'm a little familiar with html and using // or <- to hide text in code.

    I'll have to look at everything again. Thanks.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2013

    If it works for you then why is there code in the body ? This code goes in the class.BotStop.plugin.php as posted above and in various places....

    <?php if (!defined('APPLICATION')) exit();
    
    // Define the plugin:
    $PluginInfo['BotStop'] = array(
       'Description' => "Adds a question designed to stop bots from registering",
       'Version' => '1.0.1',
       'Author' => "David Massey",
       'AuthorEmail' => '[email protected]',
       'AuthorUrl' => ''
    );
    
    
    class BotStop extends Gdn_Plugin 
    
    {
    
    public function Setup() 
            {
            SaveToConfig('Plugins.BotStop.Question', 'What is three plus three?');
            SaveToConfig('Plugins.BotStop.Answer1', '6');
            SaveToConfig('Plugins.BotStop.Answer2', 'six');
            }
    
      public function UserModel_BeforeRegister_Handler($Sender)
        {
            $test = $Sender->EventArguments['User']['BotCheck'];
            $a1 = C('Plugins.BotStop.Answer1');
            $a2 = C('Plugins.BotStop.Answer2');
               $randnumber = $Sender->EventArguments['User']['BotResult'];
           //  test for random question
             if ($randnumber != $test)
           // unrandomized answer one and two commented out 
           //  if ($test != $a1 && $test != $a2)
            {
            $Sender->Validation->AddValidationResult('BotCheck',T('Your humanity is suspect... Please try again.'));
            $Sender->EventArguments['Valid'] = FALSE;
            }
           // return FALSE;
        }
    
    
        public function Base_GetAppSettingsMenuItems_Handler($Sender)
        {
            $Menu = $Sender->EventArguments['SideMenu'];
            $Menu->AddItem('Forum', T('Forum'));
            $Menu->AddLink('Forum', T('BotStop'), 'settings/botstop', 'Garden.Settings.Manage');
        }
    
    
        public function SettingsController_BotStop_Create($Sender)
        {
    
            $Sender->Permission('Garden.Settings.Manage');
                    $Sender->Form = new Gdn_Form();
                    $Validation = new Gdn_Validation();
                    $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
                    $ConfigurationModel->SetField(array('Plugins.BotStop.Question','Plugins.BotStop.Answer1','Plugins.BotStop.Answer2',));
                    $Sender->Form->SetModel($ConfigurationModel);
            $Sender->Title('BotStop Plugin Settings');
            $Sender->AddSideMenu('settings/botstop');
    
        if ($Sender->Form->AuthenticatedPostBack() === FALSE) 
         {
         $Sender->Form->SetData($ConfigurationModel->Data);
         } 
         else 
         {
         $Data = $Sender->Form->FormValues();
         if ($Sender->Form->Save() !== FALSE) $Sender->StatusMessage = T("Your settings have been saved.");
         }
        $Sender->Render($this->GetView('settings.php'));
        }
    }
    
    ?>
    
    

    This code in the new file you need to create and call it registerapproval.php put it in the views folder of the plugin then copy the code for registerapproval.php that peregrine made onto it.

    http://vanillaforums.org/discussion/20464/feedback-on-botstop-plugin#latest

  • Thanks for the help. This sucks. I can't seem to get it. I've gone over everything again and again. Now, the coding is gone, but I can't enable the BotStop plugin. I get a big Red/Yellow pop-up because there's a "fatal error". And it seems to list the class.BotStop.plugin.php 3 times and the last word is "success".

    ?

  • I also notice that your code (vrijvlinder) is shorter than whu606's above ??

  • Do I mess with this ---> "applications/dashboard/views/entry/registerapproval.php"

    "registerapproval.php" <------ do I leave it and just copy it or do I remove it from the above directory and move it vs copy? I know these all sound like dumb questions, but about to just start all over. This is horrible.

    None of the stuff in the two forum post that I've "copied" is working.

    But one is for sure, the Bot applications are killing me and I don't think I can continue using Vanilla if I can't control the Bot apps. But I'd like to continue using it....

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I don't know what else to tell you, I know it can be a bit complex but as long as you copied the stuff correctly and placed it where it was supposed to go, it should work.
    The pop up for fatal error message can indicate the error. Usually it has to do with mistakes like missing ' or expected such but got unexpected ')' . Maybe someone can zip you a fixed plugin so all you have to do is put it in the plugin folder to replace this one...

    If what you want is to stop bots I can tell you that is works super fine with basic registration.

Sign In or Register to comment.