ulgm_groups_registration_form_after_password_confirm
Fires after the password confirmation field is displayed on the group registration form.
add_action( 'ulgm_groups_registration_form_after_password_confirm', $callback, 10, 1 );
Description
Fires after the password confirmation field on the Uncanny Groups registration form. Developers can use this hook to add custom fields or logic below the password confirmation, before the enrollment key section.
Usage
add_action( 'ulgm_groups_registration_form_after_password_confirm', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example function to add a custom field after the confirm password field on the user registration form.
*
* This hook fires after the password confirmation field has been rendered.
*
* @param array $form_data An array containing data about the form, potentially including user input if this were a form submission.
*/
add_action( 'ulgm_groups_registration_form_after_password_confirm', 'my_custom_registration_field_after_password_confirm', 10, 1 );
function my_custom_registration_field_after_password_confirm( $form_data ) {
// In a real scenario, you might want to check if this is an AJAX request or a standard form submission.
// For this example, we'll just add a static HTML element.
// Imagine you want to add a custom text field for a "Referral Code"
?>
<tr>
<td class="label"><label for="referral_code"><?php esc_html_e( 'Referral Code (Optional)', 'my-text-domain' ); ?></label></td>
<td class="input">
<input type="text" name="referral_code" id="referral_code" class="input-text" value="<?php echo isset( $form_data['referral_code'] ) ? esc_attr( $form_data['referral_code'] ) : ''; ?>" placeholder="<?php esc_attr_e( 'Enter referral code if you have one', 'my-text-domain' ); ?>"/>
</td>
</tr>
<?php
}
/**
* Example function to display a message after the confirm password field.
*
* This hook fires after the password confirmation field has been rendered.
*
* @param array $form_data An array containing data about the form.
*/
add_action( 'ulgm_groups_registration_form_after_password_confirm', 'display_password_strength_hint', 20, 1 );
function display_password_strength_hint( $form_data ) {
// This example displays a simple hint about password requirements.
// In a real-world scenario, you might fetch dynamic requirements or use JavaScript for real-time feedback.
?>
<tr class="password-hint-row">
<td colspan="2">
<small><?php esc_html_e( 'Password must be at least 6 characters long.', 'my-text-domain' ); ?></small>
</td>
</tr>
<?php
}
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:104
minlength="6"
oninput="check(this)"
class="required"
placeholder="<?php esc_html_e( 'Confirm Password', 'uncanny-learndash-groups' ); ?>"
type="password"/></td>
</tr>
<!-- Confirm Password __ END -->
<?php do_action( 'ulgm_groups_registration_form_after_password_confirm' ); ?>
<?php do_action( 'ulgm_groups_registration_form_before_enrollment_key' ); ?>
<!-- Enrollment key __ START -->
<tr>
<td class="label"><label
for="code_registration"><?php esc_html_e( 'Enrollment key', 'uncanny-learndash-groups' ); ?></label>
</td>
<td class="input">