Last active
June 17, 2020 18:02
-
-
Save mburnette/86eaace202c4e554ec02edd5ad7c86f8 to your computer and use it in GitHub Desktop.
[Require last name] Require last name for donation in GiveWP. #GiveWP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // only copy this line if needed | |
/** | |
* Require Last Name Snippet. | |
* | |
* Adds asterisk and error validation to the last name field of all Give forms. | |
* Modified from https://github.com/impress-org/givewp-snippet-library/blob/master/form-customizations/require-last-name.php | |
* | |
* @param $required_fields | |
* @param $form_id | |
* | |
* @return mixed | |
*/ | |
function give_require_last_name( $required_fields, $form_id ) { | |
$required_fields['give_last'] = array( | |
'error_id' => 'invalid_last_name', | |
'error_message' => __( 'Please enter your last name', 'give' ) | |
); | |
return $required_fields; | |
} | |
add_filter( 'give_donation_form_required_fields', 'give_require_last_name', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment