Action uncanny-learndash-groups

ulgm_groups_registration_form_before_first_name

Fires before the first name field is displayed on the group registration form, allowing for custom additions.

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

Description

Fires before the first name field is displayed on the user registration form. Developers can use this hook to add custom fields, modify existing ones, or inject content above the first name input.


Usage

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

Examples

<?php
/**
 * Example function to add a custom field before the first name field on the Uncanny Groups registration form.
 *
 * This function demonstrates how to hook into the 'ulgm_groups_registration_form_before_first_name'
 * action to insert custom HTML content. In this example, we're adding a simple text input
 * for a "Middle Name".
 *
 * @param array $form_data The existing form data (if any).
 */
function my_custom_registration_field_before_first_name( $form_data = [] ) {
	?>
	<!-- Custom Middle Name Field -->
	<tr>
		<td class="label"><label for="ulgm_user_middle"><?php esc_html_e( 'Middle Name', 'my-custom-plugin' ); ?></label></td>
		<td class="input">
			<input
				type="text"
				name="ulgm_user_middle"
				id="ulgm_user_middle"
				value="<?php echo isset( $form_data['ulgm_user_middle'] ) ? esc_attr( $form_data['ulgm_user_middle'] ) : ''; ?>"
			/>
		</td>
	</tr>
	<!-- End Custom Middle Name Field -->
	<?php
}
add_action( 'ulgm_groups_registration_form_before_first_name', 'my_custom_registration_field_before_first_name', 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:18

return ob_get_clean();
}
?>
	<form id="ulgm_registration_form" class="uncanny-learndash-groups uo-groups-registration" action="" method="POST">
		<fieldset>
			<?php do_action( 'ulgm_groups_registration_form_start' ); ?>
			<table class="table table-form form-table clr">
				<?php do_action( 'ulgm_groups_registration_form_before_first_name' ); ?>
				<!-- First name  __ START -->
				<tr>
					<td class="label"><label
								for="ulgm_user_first"><?php esc_html_e( 'First name', 'uncanny-learndash-groups' ); ?></label>
					</td>
					<td class="input">
						<input name="ulgm_user_first"


Scroll to Top