Action uncanny-toolkit-pro

ulgm_after_register_group_signup_permalink

Fires after a group signup permalink is successfully registered, allowing for further customization or processing.

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

Description

Fires after the rewrite rule for group signup permalinks is registered. Developers can use this hook to add custom rewrite rules or modify existing ones related to group signups. It fires during the plugin's initialization process.


Usage

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

Examples

/**
 * Example of using the ulgm_after_register_group_signup_permalink hook.
 * This function might be used to perform additional actions after the group signup permalink
 * has been registered, such as logging the action or performing other side effects.
 */
add_action( 'ulgm_after_register_group_signup_permalink', function() {
	// In a real-world scenario, you might want to log that the permalink was registered.
	// This could be useful for debugging or auditing.
	if ( WP_DEBUG === true ) {
		error_log( '[ULGM Debug] Group signup permalink registered successfully.' );
	}

	// You could potentially use this hook to update some plugin settings
	// or trigger other processes that depend on permalink registration.
	// For example, if you had a setting to automatically enable SEO for new group signups,
	// you could conditionally set that here.

	// Let's simulate updating a custom option in the database.
	// In a real plugin, this would likely be tied to specific plugin configurations.
	$option_name = 'ulgm_group_signup_permalink_last_registered';
	$current_time = current_time( 'mysql' );
	update_option( $option_name, $current_time );

	// Note: The original function already calls flush_rewrite_rules().
	// It's generally not recommended to call flush_rewrite_rules() repeatedly within hooks
	// that might fire often, as it can impact performance. The to-do comment in the
	// source code highlights this potential issue. This example focuses on demonstrating
	// actions *after* the permalink is registered, not on modifying the permalink registration itself.

}, 10, 0 ); // 10 is the default priority, 0 means no accepted arguments

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/learn-dash-group-sign-up.php:1099

public static function register_group_signup_permalink(){
		do_action( 'ulgm_before_register_group_signup_permalink' );
		add_rewrite_rule( '^sign-up/([^/]+)/?$', 'index.php?ulgm_group_slug=$matches[1]&ulgm_signup=1', 'top' );
		do_action( 'ulgm_after_register_group_signup_permalink' );

		// @todo: We need a way to run this for this specific module once the module gets initialized for the first time or gets initialized or re-enabled.
		flush_rewrite_rules();
	}


Scroll to Top