Action uncanny-learndash-groups

ulgm_config_setup_after

Fires after the core configuration settings have been set up and loaded.

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

Description

Fired after core plugin constants are defined. Developers can use this hook to perform custom actions or configurations that depend on the plugin's core settings and constants being available, but before the plugin fully boots.


Usage

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

Examples

// Example of using the 'ulgm_config_setup_after' action hook.
// This function demonstrates how to conditionally load a script
// or style based on a plugin setting that might have been defined or modified
// during the config setup process.
add_action( 'ulgm_config_setup_after', 'my_custom_ulgm_config_handler', 10, 0 );

function my_custom_ulgm_config_handler() {
    // Assume there's a way to get a plugin option, for example, using get_option()
    // or a custom option retrieval function provided by the ULGM plugin itself.
    // Let's simulate retrieving a boolean option 'enable_custom_feature'.
    $enable_custom_feature = get_option( 'ulgm_enable_custom_feature', false ); // Default to false if not set

    if ( true === $enable_custom_feature ) {
        // If the custom feature is enabled, enqueue a specific JavaScript file.
        // This is a common use case after configuration is finalized.
        wp_enqueue_script(
            'my-ulgm-custom-script',
            plugin_dir_url( __FILE__ ) . 'js/ulgm-custom-feature.js', // Replace with actual path to your script
            array( 'jquery' ), // Dependencies
            '1.0.0', // Version
            true // Load in footer
        );

        // You could also enqueue a stylesheet if needed
        // wp_enqueue_style(
        //     'my-ulgm-custom-style',
        //     plugin_dir_url( __FILE__ ) . 'css/ulgm-custom-feature.css', // Replace with actual path to your CSS
        //     array(),
        //     '1.0.0'
        // );
    }
}

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/class-config.php:104

public function configure_plugin_before_boot( $plugin_name, $prefix, $version, $file, $debug ) {

		$this->define_constants( $plugin_name, $prefix, $version, $file, $debug );

		do_action( 'ulgm_define_constants_after' );

		do_action( 'ulgm_config_setup_after' );
	}


Scroll to Top