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