Action uncanny-learndash-groups

ulgm_groups_registration_form_after_enrollment_key

Fires after the enrollment key is displayed on the group registration form.

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

Description

Fires after the enrollment key field on the user registration form. Developers can use this hook to add custom fields or content after the enrollment key input, allowing for extended registration form functionality.


Usage

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

Examples

add_action( 'ulgm_groups_registration_form_after_enrollment_key', 'my_custom_enrollment_key_logic', 10, 0 );

/**
 * Example function to add custom validation or display additional fields after the enrollment key on the group registration form.
 * This hook fires after the enrollment key input field has been rendered.
 *
 * @since 1.0.0
 */
function my_custom_enrollment_key_logic() {
	// Example: Add a hidden field for a custom identifier if needed.
	?>
	<input type="hidden" name="my_custom_group_identifier" value="some_predefined_value" />
	<?php

	// Example: Perform a custom check or display a message related to the enrollment key.
	// This could involve checking if a specific enrollment key requires additional information.
	if ( isset( $_POST['ulgm_code_registration'] ) && ! empty( $_POST['ulgm_code_registration'] ) ) {
		$enrollment_key = sanitize_text_field( $_POST['ulgm_code_registration'] );

		// Simulate a check for a specific enrollment key that needs extra details.
		if ( 'SPECIALKEY123' === $enrollment_key ) {
			?>
			<tr>
				<td class="label"><label for="custom_extra_field"><?php esc_html_e( 'Additional Detail:', 'your-text-domain' ); ?></label></td>
				<td>
					<input type="text" id="custom_extra_field" name="custom_extra_field" value="" placeholder="<?php esc_html_e( 'Enter required detail', 'your-text-domain' ); ?>" required />
				</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:122

value="<?php if ( ulgm_filter_has_var( 'ulgm_code_registration', INPUT_POST ) ) {
								   echo sanitize_text_field( ulgm_filter_input( 'ulgm_code_registration', INPUT_POST ) );
							   } ?>"
							   placeholder="<?php esc_html_e( 'Enrollment key', 'uncanny-learndash-groups' ); ?>"
							   type="text"/></td>
				</tr>
				<!-- Enrollment key __ END -->
				<?php do_action( 'ulgm_groups_registration_form_after_enrollment_key' ); ?>
				<!-- Terms __ START -->
				<?php
				if ( ! empty( SharedVariables::ulgm_term_condition() ) && 'yes' === GroupManagementRegistration::$code_registration_atts['enable_terms'] ) {
					?>
					<?php do_action( 'ulgm_groups_registration_form_before_terms' ); ?>
					<tr>
						<td class="label"><label


Scroll to Top