Action uncanny-learndash-groups

ulgm_groups_registration_form_end

Fires after the group registration form has been fully rendered, allowing for modifications.

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

Description

Fired at the very end of the Uncanny Groups registration form, before the closing

tag. Developers can use this hook to add custom content, scripts, or modify form elements after all default fields and buttons have been rendered.


Usage

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

Examples

<?php
/**
 * Example function to add custom fields or logic to the end of the Uncanny Groups registration form.
 *
 * This function demonstrates how you might add a custom disclaimer or additional instructions
 * before the form is fully submitted.
 *
 * @param Uncanny_Learndash_Groups $plugin_instance The instance of the Uncanny Groups plugin.
 */
function my_custom_groups_registration_end_logic( $plugin_instance ) {
	// Check if the current user is an administrator for this example.
	// In a real scenario, you might check for other conditions or display different content.
	if ( current_user_can( 'manage_options' ) ) {
		?>
		<div style="margin-top: 20px; padding: 15px; background-color: #f0f0f0; border: 1px solid #ccc;">
			<p><strong>Administrator Note:</strong> This is a custom message added via the <code>ulgm_groups_registration_form_end</code> hook.</p>
			<p>Ensure all group details are accurate before proceeding.</p>
		</div>
		<?php
	}

	// You could also add custom hidden fields here if needed.
	// For example, to track the source of the registration if you have multiple entry points.
	// echo '<input type="hidden" name="registration_source" value="custom_hook">';
}

// Hook the function to the 'ulgm_groups_registration_form_end' action.
// The second parameter '10' is the priority, and '1' indicates that the function accepts one argument.
add_action( 'ulgm_groups_registration_form_end', 'my_custom_groups_registration_end_logic', 10, 1 );

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

<input type="hidden" name="key"
							   value="<?php echo crypt( get_the_ID(), 'uncanny-learndash-groups' ); ?>"/>
					</td>
				</tr>
				<!-- Buttons __ END -->
				<?php do_action( 'ulgm_groups_registration_form_after_buttons' ); ?>
			</table>
			<?php do_action( 'ulgm_groups_registration_form_end' ); ?>
		</fieldset>
	</form>
	<script type='text/javascript'>
		function check(input) {
			if (input.value != document.getElementById('password').value) {
				input.setCustomValidity('<?php _e( 'Passwords do not match.', 'uncanny-learndash-groups' ) ?>')
			} else {


Scroll to Top