Skip to content

Daniel Auener

Daniel Auener Daniel Auener

Check out my blog and what I’m working on right now

  • The WordPressers Guide to the Fediverse December 17, 2022
  • 10 Reasons a Mastodon Migration Makes Sense for the WordPress Community (and others) December 8, 2022
  • Mastodon WordPress Instance November 19, 2022
  • Mastodon Instance for Kalmar started November 13, 2022
  • WordPress Rest API extensions for going headless WP May 14, 2019

Links

Northosts AB – Small WordPress Agency in Kalmar

Northemes – WordPress Website LeasingĀ 

wptoots.social – WordPress Community Mastodon Instance

wp-community-on-mastodon.wptoots.social – Curated list of the WordPress community on Mastodon

Tag: registration

WordPress register with email only, using Gravity Forms and User Registration add-on

danielNovember 7, 2013November 7, 2013
<?php

/**
 * WordPress register with email only, make it possible to register with email 
 * as username in a multisite installation
 * @param  Array $result Result array of the wpmu_validate_user_signup-function
 * @return Array         Altered result array
 */
function custom_register_with_email($result) {

	if ( $result['user_name'] != '' && is_email( $result['user_name'] ) ) {

		unset( $result['errors']->errors['user_name'] );

	}

	return $result;
}
add_filter('wpmu_validate_user_signup','custom_register_with_email');

?>

The snippets story

Some days ago I’ve implemented a custom user registration with WordPress. I used Gravity Forms with the User Registration add-on, which worked fine when the user had to choose an username manually. But we wanted even a quick-registration option on the startsite, which we wanted to work with only one form-field asking for an email-address. So I built a Gravity Form with just a email field and added a User Registration with the email-field linked both as the required users email and username.

Works fine with a single install, but with a multi-site installation the wpmu_validate_user_signup-function is used and we got an “Only lowercase letters (a-z) and numbers are allowed.” error-message. The above filter fixes this issue by undoing this validation error and forcing WordPress to accept an email address as username.

Snippets, Wordpress 022
Daniel Auener Solutions AB
Org-nr: 559101-4575

ask@danielauener.com
+46 (0) 48 010 626