Action uncanny-learndash-groups

ulgm_groups_key_redemption_form_start

Fires at the beginning of the group key redemption form, allowing modifications before display.

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

Description

Fires at the beginning of the Uncanny Groups key redemption form. Developers can use this action to inject custom content or modify the form structure before the enrollment key field is displayed. This hook is useful for adding introductory text, consent checkboxes, or other elements.


Usage

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

Examples

add_action( 'ulgm_groups_key_redemption_form_start', 'my_custom_ulgm_key_redemption_form_start', 10 );

/**
 * Add custom content at the beginning of the Uncanny Groups key redemption form.
 *
 * This function demonstrates adding a custom message or a small informational
 * block before the main form fields appear.
 *
 * @since 1.0.0
 */
function my_custom_ulgm_key_redemption_form_start() {
	// Check if the current user is logged in. If not, perhaps display a different message.
	if ( is_user_logged_in() ) {
		$current_user = wp_get_current_user();
		?>
		<div class="ulgm-custom-form-start-message">
			<p><?php printf( esc_html__( 'Hello %s, please enter your enrollment key below to join a group.', 'your-text-domain' ), esc_html( $current_user->display_name ) ); ?></p>
		</div>
		<?php
	} else {
		?>
		<div class="ulgm-custom-form-start-message">
			<p><?php esc_html_e( 'Please enter your enrollment key below. You may need to log in or register first.', 'your-text-domain' ); ?></p>
		</div>
		<?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-code-redemption.php:20

</div>
	<?php
	return ob_get_clean();
}
?>
	<form id="ulgm_registration_form" class="uncanny-learndash-groups" action="" method="POST">
		<fieldset>
			<?php do_action( 'ulgm_groups_key_redemption_form_start' ); ?>
			<table class="table table-form form-table clr">
				<?php do_action( 'ulgm_groups_key_redemption_form_before_enrollment_key' ); ?>
				<tr>
					<td class="label"><label
								for="code_registration"><?php esc_html_e( 'Enrollment key', 'uncanny-learndash-groups' ); ?></label>
					</td>
					<td class="input">


Scroll to Top