Skip to main content

Auto Registration

Auto Registration automatically creates WordPress/WooCommerce accounts for users who sign in with Google for the first time. This removes friction and enables one-click account creation.

How It Works​

When a new user signs in with Google:

User clicks Google Sign-In
↓
Plugin checks if email exists in WordPress
↓
Email NOT found → Create new account
↓
Assign default role
↓
Log user in
↓
User redirected (same page or custom URL)

Configuration​

Enable Auto Registration​

  1. Go to Settings > OneTap Login
  2. Click Users tab
  3. Check Auto-register users
  4. Select Default role
  5. Save Changes

Default Role​

RoleDescriptionUse Case
CustomerWooCommerce customerE-commerce stores
SubscriberBasic WordPress roleBlogs, membership
ContributorCan write postsMulti-author sites
AuthorCan publish postsContent platforms
WooCommerce Detection

If WooCommerce is active, "Customer" is the default. Without WooCommerce, "Subscriber" is used.

User Data Collection​

When an account is created, the plugin collects:

DataWordPress FieldSource
Emailuser_emailGoogle account
First Namefirst_nameGoogle profile
Last Namelast_nameGoogle profile
Display Namedisplay_nameCombined name
Usernameuser_loginGenerated
Google ID_onetap_google_idGoogle account

Username Generation​

Since Google doesn't provide usernames, the plugin generates one:

Algorithm:

  1. Extract email prefix: john@gmail.com → john
  2. Check if exists in WordPress
  3. If taken, append number: john2, john3, etc.

Examples:

john@gmail.com     → john
john@company.com → john2 (if john exists)
john.doe@site.com → johndoe
j.smith@corp.com → jsmith

Display Name​

Format: {First Name} {Last Name}

Examples:

  • "John Smith"
  • "María García"
  • "田中 太郎"

Account Creation Methods​

With WooCommerce​

Uses wc_create_new_customer():

$customer_id = wc_create_new_customer(
$email,
$username,
'' // No password
);

Benefits:

  • Creates proper WooCommerce customer
  • Triggers WooCommerce hooks
  • Sets up customer meta
  • Compatible with WC extensions

Without WooCommerce​

Uses wp_insert_user():

$user_id = wp_insert_user([
'user_login' => $username,
'user_email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'role' => $default_role
]);

User Meta Stored​

The plugin stores additional meta data:

Meta KeyValuePurpose
_onetap_google_idGoogle user IDLink Google to WP account
_onetap_registered_viagoogleTrack registration source
_onetap_first_loginTimestampFirst Google login time
_onetap_login_countNumberTotal Google logins
_onetap_avatar_urlURLGoogle profile picture

When Registration Doesn't Happen​

Auto registration is skipped when:

1. Email Already Exists​

Email found in WordPress
↓
Link Google to existing account
↓
No new user created

2. Auto Registration Disabled​

Setting disabled
↓
"Account not found" error shown
↓
User must register manually first

3. Domain Restricted (PRO)​

Email domain not in whitelist
↓
"Domain not allowed" error shown
↓
Registration blocked

4. Pending Approval (PRO)​

User created with pending status
↓
"Awaiting approval" message shown
↓
Admin must approve

Hooks for Developers​

After User Registration​

// Fires after a new user is created via Google
do_action('onetap_user_registered', $user_id, $google_data);

Example usage:

add_action('onetap_user_registered', function($user_id, $google_data) {
// Send welcome email
// Add to CRM
// Trigger automation
}, 10, 2);

Before User Registration​

// Filter to modify user data before creation
$user_data = apply_filters('onetap_user_data', $user_data, $google_data);

Example usage:

add_filter('onetap_user_data', function($user_data, $google_data) {
// Add custom field
$user_data['nickname'] = $google_data['given_name'];
return $user_data;
}, 10, 2);

Password Handling​

No Password Set​

Google users don't have a WordPress password by default:

  • Authentication happens via Google
  • No password email sent
  • No password in database

Enabling Password​

Users can set a password through:

  1. Password reset (/wp-login.php?action=lostpassword)
  2. Profile page (/wp-admin/profile.php)
  3. WooCommerce My Account

Dual Authentication​

After setting password, users can:

  • Sign in with Google (One Tap or button)
  • Sign in with username/password
  • Both methods work

Email Notifications​

WordPress Registration Email​

By default, WordPress sends a registration email. The plugin:

  • Allows the default email to send
  • Or replaces with custom welcome email (PRO)

Disabling Default Email​

// In your theme's functions.php
add_filter('onetap_send_registration_email', '__return_false');

Custom Welcome Email (PRO)​

With PRO, you can:

  • Customize the welcome email
  • Use merge tags
  • Choose templates

See Welcome Email Editor for details.

Role Assignment​

Default Behavior​

All new Google users get the configured default role.

Role Mapping (PRO)​

Assign different roles based on email domain:

DomainRole
company.comEditor
partner.orgContributor
* (default)Customer

See Role Mapping for configuration.

Disabling Auto Registration​

When to Disable​

  • Closed membership sites
  • Employee-only portals
  • Sites requiring manual approval
  • Invitation-only communities

What Happens When Disabled​

  1. User clicks Google Sign-In
  2. Google authentication completes
  3. Plugin checks for existing account
  4. No account found → Error displayed
  5. User told to register manually

Error Message​

Default: "No account found. Please register first."

Customizable in error message settings.

Security Considerations​

Email Verification​

Google verifies email ownership, so:

  • No additional email verification needed
  • Email is guaranteed to be valid
  • No fake email registrations

Role Restrictions​

For security, these roles are never auto-assigned:

  • Administrator
  • Editor (unless via Role Mapping PRO)
  • Shop Manager

Rate Limiting​

The plugin includes rate limiting:

  • 10 registrations per IP per 5 minutes
  • Prevents automated account creation
  • Can be adjusted (for developers)

Statistics​

Track registrations in the Statistics section:

MetricDescription
Total RegistrationsAll-time Google registrations
TodayRegistrations today
This WeekRegistrations this week
This MonthRegistrations this month

See Basic Statistics for details.

Common Use Cases​

E-commerce Store​

Auto-register: Enabled
Default role: Customer
Result: Frictionless checkout accounts

Membership Site​

Auto-register: Enabled
Default role: Subscriber
Result: Easy member signups

B2B Portal​

Auto-register: Enabled
Domain restriction: @company.com
Default role: Customer
Result: Only company employees

Closed Community​

Auto-register: Disabled
Result: Manual registration required

Troubleshooting​

User Not Created​

  1. Check auto-register is enabled
  2. Verify email doesn't already exist
  3. Check error messages displayed
  4. Review debug logs

Wrong Role Assigned​

  1. Check default role setting
  2. If using Role Mapping (PRO), check domain rules
  3. Verify user doesn't already exist (keeps existing role)

Missing User Data​

  1. Verify Google OAuth scopes include email and profile
  2. Check Google Cloud Console configuration
  3. Test with different Google account

Next Steps​