Action uncanny-learndash-groups

ulgm_groups_registration_form_after_email

Fires after the email field is displayed on the user group registration form.

add_action( 'ulgm_groups_registration_form_after_email', $callback, 10, 1 );

Description

Fires after the email input field on the Uncanny Groups registration form. Developers can use this action to add custom content, fields, or logic immediately following the email input, allowing for dynamic form modifications.


Usage

add_action( 'ulgm_groups_registration_form_after_email', 'your_function_name', 10, 1 );

Examples

<?php
/**
 * Example of adding custom functionality after the email field in the Uncanny Groups registration form.
 * This example will add a tooltip to the email field based on user role.
 *
 * @param array $form_data An array containing the current form data. (This hook doesn't pass parameters, but the context suggests it *could*).
 */
add_action( 'ulgm_groups_registration_form_after_email', 'my_custom_email_field_enhancement', 10 );

function my_custom_email_field_enhancement() {
	// This hook is placed right after the email input field.
	// We can add some HTML or JavaScript here to modify the form.

	// For demonstration, let's add a small text note below the email field.
	// In a real-world scenario, you might pass data to JavaScript to dynamically
	// show/hide elements or add complex validation.

	// Check if the current user has a specific role and display a different message.
	if ( current_user_can( 'administrator' ) ) {
		echo '<p class="description" style="color: blue;"><strong>Admin Note:</strong> New users will be automatically assigned to a default group.</p>';
	} else {
		echo '<p class="description" style="color: gray;"><em>Please enter your primary email address.</em></p>';
	}
}

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:71

placeholder="<?php esc_html_e( 'Email / Username', 'uncanny-learndash-groups' ); ?>"
							   value="<?php if ( ulgm_filter_has_var( 'ulgm_user_email', INPUT_POST ) ) {
								   echo sanitize_email( ulgm_filter_input( 'ulgm_user_email', INPUT_POST ) );
							   } ?>"
							   class="required" type="email"/></td>
				</tr>
				<!-- Email / Username __ END -->
				<?php do_action( 'ulgm_groups_registration_form_after_email' ); ?>
				<?php do_action( 'ulgm_groups_registration_form_before_password' ); ?>
				<!-- Password  __ START -->
				<tr>
					<td class="label"><label
								for="password"><?php esc_html_e( 'Password', 'uncanny-learndash-groups' ); ?></label>
					</td>
					<td class="input">


Scroll to Top