ulgm_after_license_details
Fires after the license details have been displayed on the page.
add_action( 'ulgm_after_license_details', $callback, 10, 1 );
Description
Fires after license details are displayed in the admin area. Developers can use this hook to add custom information or modify the license display. It passes the license data object for use in custom functions.
Usage
add_action( 'ulgm_after_license_details', 'your_function_name', 10, 1 );
Parameters
-
$license_data(mixed) - This parameter contains license data that may include customer name and email.
Examples
<?php
/**
* Example function to add custom information after license details.
*
* This function demonstrates how to hook into the 'ulgm_after_license_details'
* action hook to display additional license-related information.
*
* @param object $license_data The license data object passed by the hook.
*/
function my_custom_license_info_callback( $license_data ) {
// Check if the license data is valid and contains an expiration date.
if ( isset( $license_data->expires ) && ! empty( $license_data->expires ) ) {
// Convert the expiration date to a more readable format.
$expiration_date = date( 'F j, Y', strtotime( $license_data->expires ) );
// Display the expiration date in a styled paragraph.
echo '<p><strong>License Expiration:</strong> ' . esc_html( $expiration_date ) . '</p>';
} else {
// If no expiration date is found, display a message.
echo '<p><em>License expiration date not available.</em></p>';
}
// You could also check for other properties of $license_data and display them.
// For example:
// if ( isset( $license_data->license_status ) ) {
// echo '<p><strong>License Status:</strong> ' . esc_html( ucwords( str_replace( '_', ' ', $license_data->license_status ) ) ) . '</p>';
// }
}
// Hook the custom function to the 'ulgm_after_license_details' action.
// The '10' is the default priority, and '1' indicates that the callback
// function accepts one argument ($license_data).
add_action( 'ulgm_after_license_details', 'my_custom_license_info_callback', 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/classes/admin/licensing/admin-license.php:147
<br/>
<?php
if ( isset( $license_data->customer_name ) ) {
printf( '<strong>%s:</strong> %s (%s)', __( 'Account', 'uncanny-learndash-groups' ), $license_data->customer_name, $license_data->customer_email );
}
?>
</p>
<?php do_action( 'ulgm_after_license_details', $license_data ); ?>
</div>
<?php } else { ?>
<input id="ulgm-license-field"
name="<?php echo uncanny_learndash_groupsUtilities::get_prefix(); ?>_license_key" type="password"
value="<?php esc_attr_e( $license ); ?>"
placeholder="<?php _e( 'Enter your license key', 'uncanny-learndash-groups' ); ?>"