ulgm_groups_registration_form_before_terms
Fires before the user terms and conditions appear on the group registration form.
add_action( 'ulgm_groups_registration_form_before_terms', $callback, 10, 1 );
Description
Fires before the terms and conditions checkbox is displayed on the group registration form. Developers can use this hook to insert custom content or modify the form's appearance before the terms section, offering flexibility in extending the registration process.
Usage
add_action( 'ulgm_groups_registration_form_before_terms', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example function to add custom content before the Terms & Conditions field on the Uncanny Groups registration form.
*
* This function demonstrates how to hook into the 'ulgm_groups_registration_form_before_terms' action.
* It will prepend a small informational text above the actual terms checkbox.
*
* @param array $registration_fields The array of fields being displayed on the registration form.
* This parameter is available but not strictly needed for this specific example.
*/
add_action(
'ulgm_groups_registration_form_before_terms',
function ( $registration_fields ) {
// You can conditionally display this message based on group ID, user role, etc.
// For this example, we'll always show it.
// Get the current group's ID if available in the context (may not always be available directly here)
// In a real scenario, you might need to access it from $_GET, $_POST, or a more complex context.
// For demonstration, let's assume we want to show this only for a specific group type.
// In this context, $registration_fields might contain group-related data if passed.
// Let's assume a hypothetical 'group_id' key within $registration_fields or accessible globally.
// For demonstration, let's just add a generic message.
?>
<tr>
<td colspan="2">
<p class="ulgm-terms-info">
<?php esc_html_e( 'Please read and agree to our terms and conditions before proceeding with your group registration.', 'my-custom-plugin-textdomain' ); ?>
</p>
</td>
</tr>
<?php
},
10, // Priority: default is 10
1 // Accepted args: $registration_fields is passed to the hook
);
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:127
</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
for="terms_conditions"><?php esc_html_e( 'Terms & Conditions', 'uncanny-learndash-groups' ); ?></label>
</td>
<td class="input">
<input name="ulgm_terms_conditions" id="terms_conditions"
required="required"