This topic is locked

Login without username

3/17/2026 08:13:24
PHPRunner General questions
J
Jan author

I built a web application with a login system. A visitor can register using only an email address and a password. A username is not used because it is sometimes forgotten, whereas an email address almost never is. Therefore, I used the "email" field as the username (see screenshot).

To prevent duplicate email entries, the "email" field has been set to a unique value (in phpMyAdmin). If a user tries to register with an email address that already exists, a message appears saying this is not possible, but the message mentions "username" instead of "email address" (which is logical).

How can I adjust this message?
Do I need to change something in the screenshot?
Do I need to add event code?
Or modify something in the label editor
img alt
?

ChatGPT 3/17/2026

To adjust the error message in PHPRunner so that it refers to "email address" instead of "username," you'll typically need to modify the validation error message that is triggered when a duplicate email is detected. Here are the steps you can follow to achieve this:

Step 1: Modify the Error Message

  1. Check the Label Editor:

    • Go to the "Label Editor" in PHPRunner.
    • Look for the label associated with the "email" field.
    • Ensure that the label is correctly set to "Email Address" and not "Username." This will not directly affect the error message but will help provide clearer context in your application.


  2. Add Custom Event Code:

    • Go to the "Events" section of your PHPRunner project.
    • Locate the "Before Add" or "Before Insert" event for the registration form (depending on where the validation is occurring).
    • You can add custom PHP code to check if the email already exists and set a custom error message if it does. Here’s an example of how you might do this:

    // Assuming email field is named 'email'
    $email = $_POST['email'];
    $existingUser = db_query("SELECT COUNT(*) FROM users WHERE email='".db_prepare_string($email)."'")->fetchColumn();

    if ($existingUser > 0) {
    // Set a custom error message
    $message = "This email address is already registered. Please use a different email address.";
    // Stop the registration
    return false; // Prevent registration
    }


Step 2: Implementing the Changes

  • Make sure to test the changes by trying to register with an existing email address.
  • If your app uses AJAX for validation, ensure the custom message is returned and displayed correctly.

Step 3: Additional Considerations

  • Keep in mind that if you're using a language file for localization, you might need to update the error message in that file as well.
  • Always back up your project before making significant changes, especially when modifying event code.

Conclusion

By following these steps, you should be able to adjust the error message to refer to "email address" rather than "username." This will enhance the user experience and ensure clarity in your registration process. If you encounter any issues, refer to the PHPRunner documentation or support forums for further assistance.

Sergey Kornilov admin 3/17/2026

This part "username" is hardcoded in .lng file. You have two options here.

  1. Change the label in .lng file. This will affect all the project that you build though.
    More info: https://xlinesoft.com/phprunner/docs/localizing_runner_applications.htm
  2. Or perform a custom validation and display a custom error message. I assume that you will need to use BeforeRegister event for this purpose.