We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18830
    • 161 Posts
    I´m trying to integrate Bad Behavior (http://www.bad-behavior.ioerror.us/) into MODx as a plugin but want to include it only in some pages. Can I achieve this with help of the configurtion settings of the plugin? Or must I define a parameter?

    Thanks for any answers.

    Mazso
      • 25663 MODX Staff
      • 12,272 Posts
      Perhaps you could create an extra TV to use as a flag to signal that that page should have the plugin applied. I’d love to see this contribution shared with the community!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 18830
        • 161 Posts
        Don’t expexct too much, rthtrash. wink I`m no programmer and not sure if I´m on the right track.

        I just want to run BadBehavior without logging:

        I uploaded the BadBehavior package to the MODX plugin folder, created a new Check Box TV named spamstop and set the default value to "0", the input option values to "1" so that the plugin works on documents, where the Check Box is clicked.

        I´m not sure if the plugin code is right that should be executed on the OnLoadWebDocument event.

        $badb=$modx->getTemplateVarOutput('spamstop',$modx->documentIdentifier);
        if($badb['spamstop']=='1') {
        include_once($modx->config["base_path"].'/assets/plugins/bad-behavior-generic.php');
        }