Introductory Pricing: Save 50% on your first year of any plan. Use coupon code:

FIRSTYEAR50

  • Log In
  • Welcome
  • Features
  • Pricing
  • Documentation
  • Case Studies
  • Add Ons
  • Support
  • Learn
  • Events
  • Blog
  • Contact

Log In

Join Now | Lost Password?
Skip to content
Paid Memberships Pro WordPress Membership Plugin
  • Log In
  • Choose a Plan
  • Features
    • PMPro Platform
      • Plugin Features
      • Restrict Access
      • Register Members
      • Subscriptions
      • All Features
    • Payment Gateways
      • Stripe
      • PayPal Express
      • Paystack
      • CCBill
      • All Gateways
    • Add Ons
      • Integrations
      • Free Add Ons
      • Standard Add Ons
      • Plus Add Ons
      • All Add Ons

    Launch a Free Demo
    Explore PMPro in action with your own private demo site—preloaded with members, protected content, and premium Add Ons.

    Try PMPro Now
  • Use Cases
    • Associations
    • Blog and News
    • Communities
    • Courses
    • Directories
    • Paid Newsletters
    • Private Videos
    • Podcasting
  • Documentation
    • Download & Install
      • Download PMPro
      • Install Add Ons
      • Memberlite Theme
      • Setup WordPress
      • Staging Sites
      • Support
    • Initial Setup
      • Customize Pages
      • Payment Settings
      • Restrict Content
      • Membership Levels
      • Member Emails
      • User Fields
    • More Docs
      • Shortcodes & Blocks
      • Design Settings
      • Page Builders
      • Reporting
      • For Developers
      • All Docs

    Get your membership site up and running with Kim's help.

    Watch Initial Setup
  • Community
    • Engage & Learn
      • Upcoming Events
      • Courses
      • Videos
      • Step-by-Step Guides
      • Join Slack
      • Get Support
    • Blog
      • Case Studies
      • Product Comparison
      • Code Recipes
      • Release Notes
      • Migration Guides
      • All Blog Posts

    Join the Community
    Connect with other membership site creators who use PMPro to get paid.

    Join Slack
  • Pricing
Home  >  Blog  >  Reformat usernames to use allowed characters after checkout.

Reformat usernames to use allowed characters after checkout.

Estimated reading time: 1 minutes

TweetFacebookLinkedIn

This code recipe will convert a member’s username to match your specific rules. In this example, we convert all characters to lowercase and replace any spaces found in the username with underscores. If a member inputs a username like “John Doe”, then this will be changed to “john_doe”.

Banner for Advanced Code Recipe Tutorial for Paid Memberships Pro

About the Code Recipe

One of our members recently had a support request related to the format of usernames. Their request was for appearance reasons, but there are other cases where you would like usernames to follow stricter guidelines. For example, if you are using a single sign on bridge to integrate your members with a third-party application, you may need to match the requirements of usernames for that external site.

This code can also be useful in cases where the member’s username appears in other features of your site, such as on a BuddyPress profile.

We also see many members using their email address as their username. To protect a user’s contact information, you may want to extend this recipe to convert the @ symbol so that a user’s email address isn’t displayed publicly.

The Code Recipe

Andrew Lima

Author: Andrew Lima

Andrew Lima is the Director of Operations at Paid Memberships Pro, with a strong background in WordPress development. Certified in various programming languages, Andrew has been building WordPress websites since 2014.

He finds it rewarding to help PMPro customers build successful businesses and enjoys seeing their growth over time. Andrew values PMPro’s commitment to strong core values and ethics, which makes working with the team a genuine pleasure.

Outside of work, Andrew enjoys discovering new hobbies, experimenting in the kitchen, and immersing himself in video games.

View more articles by Andrew Lima »

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.

Take Free Course Now
Featured Image for Membership Site Development Course: The Basics


Was this article helpful?
YesNo
Tagged: pmpro_checkout_new_user_array, user_login. Posted in Code Recipes, Premium Code Recipes. Bookmark the permalink. Last updated: August 15, 2018.
Post navigation
← Choose when to Display the Renew Link to Members who Sign Up for a Membership Level with an Expiration Date
Hide Widgets for Members Only →

Paid Memberships Pro is recommended by our customers and users

Plugin Reviews

4.3 out of 5

G2

4.8 out of 5

Capterra

5 out of 5

We’re 100% GPL

Our plugin's code is not obfuscated, runs on as many sites as you want and can be customized to fit your project's needs. We just ask that you follow the GPLv2 guidelines by applying the GPLv2 license to any altered or unaltered version of PMPro that you distribute. License Details »

GPL v2

Recent Articles and Updates

  • Featured image for code recipe 'Customize Login Error Messages to Boost Account Security'
    Customize Login Error Messages to Boost Account Security
  • Banner for Memberlite v6.0
    Introducing Memberlite v6.0
  • Screenshot of featured image for 'Capture User Fields for Google Analytics Integration Add On' code recipe post
    Capture User Fields as User Properties for Reporting in Google Analytics Integration Add On

Platform

  • Pricing
  • Features
  • Product Comparison
  • Reviews
  • Case Studies
  • Screenshots
  • Videos
  • Step-by-Step Guides

Use Cases

  • Associations
  • Blog & News
  • Community
  • Courses
  • Directory & Listing
  • Paid Newsletter
  • Podcast
  • Videos

Add Ons

  • Free
  • Standard
  • Plus
  • Admin
  • Integration
  • Payment
  • Third Party
  • View All

Get Help

  • Support
  • Documentation
  • Download & Install
  • Hosting
  • Developers
  • Blog
  • Slack Community
  • Contact Us

Company

  • About Us
  • Events
  • Brand Assets
  • Affiliates
  • Accessibility Statement
  • Sitemap
  • Privacy Policy
  • Terms of Service
Join Us On

© 2025 Paid Memberships Pro™. Paid Memberships Pro is a trademark of Stranger Studios, LLC. All Rights Reserved.

Open Office Hours: Ask Me Anything with Jason and Andrew • Thursday, May 15th at 11am ET. SEE DETAILS ▸