We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    In the Bug Report thread, I talked about how registration was causing a lot of errors. I think I figured out why...

    It seems the Registered Users usergroup stopped taking new entries at the 42nd record (which happens to be Scotty’s ID tongue). Now, the internalKey<->ID numbers match in the webgroups and webuserattributes tables.

    So what could have caused this issue? It doesn’t make sense why it stopped all of a sudden at the 42nd record, of all places. I’m betting that it has something to do with that.

    I know my webhost had been doing some database upgrades, but it doesn’t make sense why it would affect that table only.

    Should I make a backup, delete users up till Scotty, then test and see if I get errors again?
      My Snippets
      -> PopUpChunk v1.0
      • 28033
      • 925 Posts
      I went ahead and deleted all of the web_user tables, and it still gave the "username already exists" error.

      I’m gonna poke around into WLPE’s coding and see if I can figure out what the issue is...

      EDIT: I forgot to mention that WLPE is sending out the "welcome to this website" e-mail, as well as adding the user. It’s just throwing out a username error, and will not add them to the Reg. Users group.

      		$checkUsername = $modx->db->query("SELECT `id` FROM ".$web_users." WHERE `username`=’".$username."’");
      $limit = $modx->recordCount($checkUsername);

      if ($limit > 0)
      {
      return $this->FormatMessage($this->LanguageArray[7]);
      }

      $lowercase = strtolower(str_replace(’ ’, ’_’, $username));
      if ($lowercase == ’default_user’)
      {
      return $this->FormatMessage($this->LanguageArray[7]);
      }

      $checkEmail = $modx->db->query("SELECT * FROM ".$web_user_attributes." WHERE `email`=’".$email."’");
      $limit = $modx->recordCount($checkEmail);

      if ($limit > 0)
      {
      return $this->FormatMessage($this->LanguageArray[8]);
      }

      Anyone good enough to notice if there is a bug that would trigger the "username already exists" when no users are in the database at all? WLPE is the center of the interactive side on my website, so it’s very important that I try to get this resolved ASAP.
        My Snippets
        -> PopUpChunk v1.0
        • 3749
        • 24,544 Posts
        Is Dr. Delicious the first user with a space in his username? wink

        That would be a clue.

        It’s been a while since I’ve done db queries, but shouldn’t those backticks in the query statement be single quotes?

        Also, if you "deleted" the web_user tables rather then "emptying" them, that could be causing the problem you’re seeing now. I’m not sure what $modx->recordCount() returns when a table doesn’t exist but it might be something that is interpreted as > 0.

        $checkUsername = $modx->db->query("SELECT `id` FROM ".$web_users." WHERE `username`=' ".$username."'");


        I would break the above line down into several lines for now to make sure it’s right:

        $queryString = "SELECT 'id' FROM ";
        $queryString .=$web_users;
        $queryString .="WHERE 'username' =";
            (etc.)
        $checkUsername = $modx->db->query($queryString);


        Hope this helps.


        Bob

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 28033
          • 925 Posts
          IIRC, yes, he was. So I suppose WLPE has an issue w/ spaces in usernames? If so, is there any way to stop it before it messes up the database?

          And I emptied them (w/ the Trash Can symbol), so it reset the internalKey/etc. back to the default value (and kept the table intact structure-wise). I had initially coverted over from PPP, and most of the people hadn’t updated their accounts, so a "fresh" install wasn’t a bad idea to go w/, IMHO.

          So once I apply that fix, and if it worked, would it resolve the usergroup issue as well?
            My Snippets
            -> PopUpChunk v1.0
            • 3749
            • 24,544 Posts
            Quote from: Soshite at Feb 05, 2008, 12:00 PM

            IIRC, yes, he was. So I suppose WLPE has an issue w/ spaces in usernames? If so, is there any way to stop it before it messes up the database?

            This line converts the spaces in the name into underline characters:

            $lowercase = strtolower(str_replace(' ', '_', $username));


            Is there code somewhere that puts them into the username before WLPE sees it or before it’s stored it in the DB?

            If you have a backup of the db, look and see if Dr. Scotty has underlines or spaces in his username.


            You need a better SQL expert than me to tell you if your query string is kosher. Did you copy it from somewhere, or did you write it/modify it?

            Bob

              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 28033
              • 925 Posts
              That was straight from Scotty’s WLPE files (the class.php one, IIRC).

              When I have time to access my site again (working on college homework), I’ll see how Scotty’s name was formatted.
                My Snippets
                -> PopUpChunk v1.0
                • 28033
                • 925 Posts
                Seems the person in charge of database backups is swamped (there were issue outside of my control for backing it up manually), I’m gonna dive into the script and see if I can fix it myself.

                Now, since I’m getting the "username already exists", is there a database/cache somewhere that still "sees" Scotty’s account (if it was his account that did it), that I need to "clear" out?
                  My Snippets
                  -> PopUpChunk v1.0