ulgm_groups_registration_form_before_buttons
Fires before the registration form buttons, allowing customization of content or fields.
add_action( 'ulgm_groups_registration_form_before_buttons', $callback, 10, 1 );
Description
Fires before the registration form's submit and reset buttons are displayed. Developers can use this hook to inject custom form fields, modify existing elements, or add JavaScript validation before the user submits the form. It provides a prime opportunity to integrate additional data collection or user experience enhancements.
Usage
add_action( 'ulgm_groups_registration_form_before_buttons', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example function to add a custom field before the registration form buttons.
* This hook allows developers to inject custom HTML or logic right before the
* submit button and nonce field on the Uncanny Groups user registration form.
*
* @since 3.0.0
*/
function my_custom_group_registration_field() {
// Add a custom input field, for instance, a referral code.
?>
<tr>
<th scope="row"><label for="referral_code"><?php esc_html_e( 'Referral Code', 'my-custom-plugin' ); ?></label></th>
<td class="input">
<input type="text" name="referral_code" id="referral_code" class="regular-text" value="" />
<p class="description"><?php esc_html_e( 'Enter the referral code if you have one.', 'my-custom-plugin' ); ?></p>
</td>
</tr>
<?php
}
// Add the custom function to the 'ulgm_groups_registration_form_before_buttons' action hook.
// The '10' is the default priority, and '0' indicates no parameters are accepted by the function.
add_action( 'ulgm_groups_registration_form_before_buttons', 'my_custom_group_registration_field', 10, 0 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/includes/forms/user-registration-form.php:145
} ?>"
type="checkbox"/><?php echo SharedVariables::ulgm_term_condition(); ?>
</td>
</tr>
<?php do_action( 'ulgm_groups_registration_form_after_terms' ); ?>
<?php } ?>
<!-- Terms __ END -->
<?php do_action( 'ulgm_groups_registration_form_before_buttons' ); ?>
<!-- Buttons __ START -->
<tr>
<td class="input">
<input type="submit" class="btn btn-default"
value="<?php esc_html_e( 'Register your account', 'uncanny-learndash-groups' ); ?>"/>
<input type="hidden" name="_ulgm_nonce"
value="<?php echo wp_create_nonce( Utilities::get_prefix() ); ?>"/>