• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Plugins » WP-Members » Documentation » Filter Hooks » wpmem_register_data

wpmem_register_data

Description

This filter hook allows you to filter the form data that is posted in the registration form prior to its insertion in the database.  Some common uses would be to filter the values for WP native fields such as “display_name” (which in WP-Members is defaulted to the username).

Parameters

$fields
(array)(required) An array of the submitted registration field data. Each field’s option name (meta key) an the array key.

$toggle
(string)(optional) A string indicating the process being handled (new|edit).

Changelog

Introduced in version 2.8.2

Source

wpmem_register_data is located in wp-members-register.php

Usage

add_filter( 'wpmem_register_data', 'my_register_data_filter', 10, 2 );

function my_register_data_filter( $fields, $toggle ) {
	/*
	 * The data from the registration form is brought in 
	 * with the $fields array.  You can filter any of the
	 * the values, and add/subtract from the array before
	 * returning the filtered result.
	 *
	 * Note that if the operation being done should only
	 * be done on "new" registration or user profile "edit"
	 * then you should include a logical test for $toggle
	 */

	if ( 'new' == $toggle ) {
		// This is a new registration
	}

	if ( 'edit' == $toggle ) {
		// This is a user profile edit
	}

	return $fields;
}

Code Snippet Library [Subscriber Content]

  • Generate Random User Display Name and Nickname
  • Multiple Selection Checkboxes
  • Add a Date of Birth Field with Dropdown Selections for Month, Day, and Year
  • Multiple Selection Checkboxes
  • Adding the WP display_name field to the WP-Members user profile update form
See a list of all filter and action hooks

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy