Members checking out will sometimes take the path of least resistance and use their email address as their username. That can cause confusion later, for example, if your site shows usernames anywhere members can see each other, like a member directory. This code recipe requires members to choose a username separate from their email address at checkout.

Real PMPro checkout page showing the error message 'Your username must not be an email address' above the Membership Information and Account Information sections

Do You Need This Recipe?

Use this recipe if you want to be sure members pick a real username instead of defaulting to their email address.

About the Code Recipe

This recipe hooks into the pmpro_registration_checks filter, the same checkout validation filter PMPro uses for other custom checks. It looks at the username a member submits and, if it contains an @ symbol, blocks checkout and shows an error asking them to choose a different username.

Real PMPro checkout page showing the error message 'Your username must not be an email address' above the Membership Information and Account Information sections

The Code Recipe

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.



Was this article helpful?
YesNo

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics