• 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
  • Store
    • Cart
    • Checkout
  • Blog
    • Basics [Free]
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Contact
  • Sign In
  • Show Search
Hide Search
Home » Plugins » WP-Members » Documentation » Filter and Action Hooks » wpmem_pre_validate_form

wpmem_pre_validate_form

Description

This filter hook allows you to filter the form data that is posted in the registration form prior to the plugin’s own validation process.

Common uses of this filter would be cases where you need to make some changes to the data before it is validated by the plugin’s validation.  For example, if you are filtering out the username field in favor of using the email as a username, you still need to pass a value for username (which would be the email).  This filter hook would allow you to filter the fields to include the email address as both the email address and the username so that default form validation does not fail.

Keep in mind the following:

  • You MUST make sure that your filter function returns the array of fields.
  • Your filtered array will need to be able to pass the plugin’s default form validation.  This means it needs to have a valid and unique username, valid and unique email address, and contain data for any of the fields that are marked as required in the plugin’s fields manager.  If for some reason the data will go outside of this requirement, you still need to pass valid data here and you can change it before the user is actually registered by filtering it with wpmem_register_data.

Usage

add_filter( 'wpmem_pre_validate_form', 'my_pre_validation_filter' );

function my_pre_validation_filter( $fields )
{
	/**
	 * 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.
	 */

	return $fields;
}
See a list of all filter and action hooks

Ready to get started?

Join Today!

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

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