uo_group_signup_before_table
Fires before the group signup table is displayed, allowing for modifications.
add_action( 'uo_group_signup_before_table', $callback, 10, 1 );
Description
Fires before the group signup form table is displayed. Developers can use this hook to add custom content or modify the form structure before the user input fields appear. The current post ID is passed as a parameter.
Usage
add_action( 'uo_group_signup_before_table', 'your_function_name', 10, 1 );
Examples
/**
* Example of how to hook into the uo_group_signup_before_table action.
* This function will add a custom field before the main table on the group signup form.
*
* @param int $group_id The ID of the current group.
*/
function my_custom_group_signup_field( $group_id ) {
// Check if the current user is logged in, as this field might be relevant only for logged-in users.
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$user_email = $current_user->user_email;
?>
<tr>
<td class="label"><label for="additional_email_field"><?php esc_html_e( 'Your Email', 'my-text-domain' ); ?></label></td>
<td class="input">
<input
type="email"
name="additional_email_field"
id="additional_email_field"
value="<?php echo esc_attr( $user_email ); ?>"
required
/>
<p class="description"><?php esc_html_e( 'Please confirm your primary email address.', 'my-text-domain' ); ?></p>
</td>
</tr>
<?php
}
}
add_action( 'uo_group_signup_before_table', 'my_custom_group_signup_field', 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/templates/group-registration-form.php:3
<form id="uncanny_group_signup_registration_form" class="uncanny_group_signup_form" action="" method="POST">
<fieldset>
<?php do_action( 'uo_group_signup_before_table', get_the_ID() ); ?>
<table class="table table-form form-table clr">
<tr>
<td class="label"><label
for="uncanny_group_signup_user_first"><?php esc_html_e( 'First Name', 'uncanny-pro-toolkit' ); ?></label>
</td>
<td class="input"><input name="uncanny_group_signup_user_first"
id="uncanny_group_signup_user_first"