• Resolved rosshepburn

    (@rosshepburn)


    Hi,

    I’ve created a registration form and my plan is that when someone registers, it creates a post in my Clients custom post type. I’ve added a Post Data field called Company Name to the form and mapped that as the username. At this stage there is only the Post Data field, email address field and submit (i plan on adding more once it’s working) but when i register to test the form, an eror appears saying ‘The username can not be empty.’ I have inserted text into the field though so it;s not empty. Could i have some help please?

    Thanks

    Ross

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @rosshepburn,

    Thank you for the details.

    I could not replicate the same behavior on my test site so far.

    In order for us to help with troubleshooting the issue, could you please export and share the form via Google Drive, Pastebin.com, Dtopbox, or a similar service. You can remove any sensitive data before exporting and uploading the files/code.

    Looking forward to your reply!

    Best Regards,
    Dmytro

    Thread Starter rosshepburn

    (@rosshepburn)

    Hi,

    Thanks for the prompt reply. You can downlaod the form from the link below.

    Exported form

    Ross

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @rosshepburn

    Thanks for sharing the form.

    I checked and you literally have a postdata field mapped as a username, just like you explained. That’s a bit surprising, I admit, and while I do understand the idea behind it, please note that this kind of field is not and never was intended to be used as user name. It’s very unusual solution and while I agree there is a bug there in Forminator, I’d rather say that the bug is that this field can be mapped to username in the first place.

    Usernames in WordPress can’t be “just anything”. The postdata field is a complex field with additional subfields and meant to put data, well, into the post. With entire field mapped as user name it really isn’t quite clear which part of the field should be used as username (eg. title or content or excerpt) and there is also a risk that the data put in the field will not really match the “structure” of expected username.

    I would rather suggest either separating that into two forms – one for registration only and the other one for creating a post – or if using single form, use separate field for username.

    Kind regards,
    Adam

    Thread Starter rosshepburn

    (@rosshepburn)

    Hi Adam,

    Thank you for looking at this for me. Yes my plan was to have the Username be the post title and the rest of the details would be manually inserted by the website admin. It just saved my client a step by creating the post for him. I didn’t take into account that some usernames would have spaces in them and that won’t work.

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @rosshepburn,,

    I hope you are doing well today!

    You’re welcome! Your plan makes sense in theory, but as you’ve noted, usernames with spaces could potentially cause issues. Here’s how you can proceed:

    1. Separate the forms: As suggested earlier, you can create two distinct forms – one for user registration and the other for creating a post. This way, you could have much more control over the data each form handles.
    2. Use a different field for usernames: You can add a dedicated username field in the registration form, which ensures the username follows WordPress guidelines on structuring a username.

    We understand the aim is to streamline the process for your client and these solutions should still offer a smooth experience.

    Kind regards,
    Zafer

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Registration Form Error – The username can not be empty.’ is closed to new replies.