Action uncanny-learndash-groups

ulgm_group_management_header

Fires in the group management header section, providing access to the current managed group ID.

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

Description

Fires after the main group management page heading is rendered. Developers can use this hook to inject custom content or modify the header area, such as adding additional navigation or summary information. It passes the ID of the currently managed group.


Usage

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

Parameters

$ulgm_current_managed_group_id (mixed)
This parameter provides the ID of the currently managed group for display purposes in the group management header.

Examples

<?php

/**
 * Example function to display a custom message in the group management header.
 *
 * This function demonstrates how to hook into the 'ulgm_group_management_header'
 * action to add custom content to the group management page header.
 *
 * @param int|null $ulgm_current_managed_group_id The ID of the currently managed group. Null if not in a group context.
 */
function my_custom_group_header_message( $ulgm_current_managed_group_id ) {

	// Only show this message if we are currently viewing a specific group.
	if ( ! is_null( $ulgm_current_managed_group_id ) && $ulgm_current_managed_group_id > 0 ) {
		$group = get_post( $ulgm_current_managed_group_id ); // Assuming groups are custom post types.

		if ( $group && 'group' === $group->post_type ) { // Adjust 'group' post type if necessary.
			echo '<div class="my-custom-group-header-alert alert alert-info">';
			echo '<p><strong>Important:</strong> You are currently managing the group: <strong>' . esc_html( $group->post_title ) . '</strong>.</p>';
			echo '<p>Remember to save any changes made.</p>';
			echo '</div>';
		}
	}
}
add_action( 'ulgm_group_management_header', 'my_custom_group_header_message', 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/frontend-uo_groups/page-heading.php:191

})
			</script>
		<?php } ?>


	</div>

	<?php do_action( 'ulgm_group_management_header', GroupManagementInterface::$ulgm_current_managed_group_id ); ?>
</section>

Scroll to Top