Description
This filter allows you to pass arguments to the registration form function to override default values that are used in the form building process. This includes default tags, labels, text, and small items including various booleans. The wpmem_inc_registration() function uses the wp_parse_args() function to merge arguments passed through this filter with the following defaults:
$defaults = array( // Wrappers. 'heading_before' => '<legend>', 'heading_after' => '</legend>', 'fieldset_before' => '<fieldset>', 'fieldset_after' => '</fieldset>', 'main_div_before' => '<div id="wpmem_reg">', 'main_div_after' => '</div>', 'txt_before' => '', 'txt_after' => '', 'row_before' => '', 'row_after' => '', 'buttons_before' => '<div class="button_div">', 'buttons_after' => '</div>', // Classes & ids. 'form_id' => ( 'new' == $tag ) ? 'wpmem_register_form' : 'wpmem_profile_form', 'form_class' => 'form', 'button_id' => '', 'button_class' => 'buttons', // Required field tags and text. 'req_mark' => $wpmem->get_text( 'register_req_mark' ), 'req_label' => $wpmem->get_text( 'register_required' ), 'req_label_before' => '<div class="req-text">', 'req_label_after' => '</div>', // Buttons. 'show_clear_form' => false, 'clear_form' => $wpmem->get_text( 'register_clear' ), 'submit_register' => $wpmem->get_text( 'register_submit' ), 'submit_update' => $wpmem->get_text( 'profile_submit' ), // Other. 'post_to' => get_permalink(), 'strip_breaks' => true, 'use_nonce' => false, 'wrap_inputs' => true, 'n' => "\n", 't' => "\t", 'register_form_action' => true, );
Parameters
$args
(array) (required) An array of arguments that are to override form $defaults.
$toggle
(string) (optional) Indicates the form that is being displayed (new|edit).
Examples
/** * This example adds a div wrapper around each * row in the registration form. */ add_filter( 'wpmem_register_form_args', function( $args, $tag ) { $args = array( 'row_before' => '<div class="my-row-wrapper">', 'row_after' => '</div>', ); return $args; }, 10, 2 ); /** * The following example would change the * class assigned to buttons. */ add_filter( 'wpmem_register_form_args', function( $args, $tag ) { $args['button_class'] = 'btn btn-primary'; return $args; }, 10, 2 ); /** * This example sets register_form_action to false to * disable the WP "register_form" action hook in the form. */ add_filter( 'wpmem_register_form_args', function( $args, $tag ) { $args['register_form_action'] = false; return $args; }, 10, 2 );
Changelog
Introduced in version 2.9.0
Source
wpmem_register_form_args is located in includes/class-wp-members-forms.php