Subscribe: RSS
  • Is it possible to make new web users created from the web login to only be activated by the admin. I am getting tons of new users daily who immediately spam the blog comments with links etc. Modx 1.0.4
    [[WebSignup? &tpl=`FormSignup` &groups=`Registered Users`]]
    
    • Edit the assets/snippets/websignup.inc.php file and change lines 126 and 127 (the sql query) to initially block the new user:
          $sql = "INSERT INTO ".$modx->getFullTableName("web_user_attributes")." (internalKey, fullname, email, blocked, zip, state, country) 
                  VALUES($key, '$fullname', '$email', ,1, '$zip', '$state', '$country');";
          $rs = $modx->db->query($sql);
      

      Note the addition of blocked after email, and setting it to 1 after the $email setting.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • I did what you suggested and got a parse error.
        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’1, ’’, ’’, ’’)’ at line 2 »
        SQL: INSERT INTO `my_database`.`modx_web_user_attributes` (internalKey, fullname, email, blocked, zip, state, country) VALUES(9, ’username’, ’email address’, ,1, ’’, ’’, ’’);
        [Copy SQL to ClipBoard]

        Parser timing
        MySQL: 0.0020 s (35 Requests)
        PHP: 0.0342 s
        Total: 0.0362 s

        Here’s my changes:
         // save user attributes
            $sql = "INSERT INTO ".$modx->getFullTableName("web_user_attributes")." (internalKey, fullname, email, blocked, zip, state, country) 
                    VALUES($key, '$fullname', '$email', ,1, '$zip', '$state', '$country');";
            $rs = $modx->db->query($sql);


        Also tried using ’1’, but that allowed the email to get through.
        • Sorry, there’s an extra comma in the code I posted.
           $sql = "INSERT INTO ".$modx->getFullTableName("web_user_attributes")." (internalKey, fullname, email, blocked, zip, state, country) 
                      VALUES($key, '$fullname', '$email', 1, '$zip', '$state', '$country');";
              $rs = $modx->db->query($sql);
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
          • Thanks Susan, that worked. grin