Results 1 to 2 of 2

Thread: duplicate user name generates wrond error message

  1. #1
    Join Date
    Mar 2005
    Posts
    14

    Default duplicate user name generates wrond error message

    Don't know if this has already been reported but I found that signing up as a member and using a name that has already been used generates the wrong error message - "you forgot to fill in one of the required fields" instead of "that user name has already been taken"

    Fixed it by using a different variable for each error, and also added in a back button for convenience:

    Code:
    	// first, make sure the user name isn't in use
    		$sql = "SELECT user_name from " . $config[table_prefix] . "UserDB WHERE user_name = $sql_user_name";
    		$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    		$recordSet = $conn->Execute($sql);
    			if ($recordSet === false) log_error($sql);
    		$num = $recordSet->RecordCount();
    		// fixes default to field not filled in error message
    		if ($num >= 1)
    			{
    			$pass_the_form = "Not";
    			$fail_message = "$lang[user_creation_username_taken]";
    			} // end if
    			
    		else
    			{
    			// validate the user form
    			$pass_the_form = validateForm(memberFormElements);
    			}
    	
    		if ($pass_the_form == "No")
    			{
    			// if we're not going to pass it, tell that they forgot to fill in one of the fields
    			echo "<p>$lang[required_fields_not_filled]</p>";
    			echo "<FORM><INPUT TYPE=\"BUTTON\" VALUE=\"$lang[back_button_text]\" onClick=\"history.back()\"></FORM>";
    			}
    		if ($pass_the_form == "Not")
    			{
    			// if we're not going to pass it, tell that the name is already in use
    			echo "<p>$lang[user_creation_username_taken]</p>";
    			echo "<FORM><INPUT TYPE=\"BUTTON\" VALUE=\"$lang[back_button_text]\" onClick=\"history.back()\"></FORM>";
    			}
    Hope this helps someone, OR 1.1.4

  2. #2
    Join Date
    Jun 2004
    Posts
    1,067

    Default

    Thanks for posting this. This is already fixed for the upcomming 2.0 release.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •