uo_gf_pre_hooks_lesson_topic_priority
Filters the priority of lesson topics before hooks are applied within the core integration.
add_filter( 'uo_gf_pre_hooks_lesson_topic_priority', $callback, 10, 1 );
Description
This filter hook runs before specific lesson and topic priority-related hooks are added to Gravity Forms in the frontend. Developers can use it to modify or disable these default hooks, influencing how lesson completion and topic priority settings are integrated into Gravity Forms.
Usage
add_filter( 'uo_gf_pre_hooks_lesson_topic_priority', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Filter the priority for lesson topic related Gravity Forms hooks.
*
* This allows other plugins or themes to adjust the order in which
* lesson topic related Gravity Forms actions and filters are applied.
* For example, if another plugin also hooks into 'gform_pre_render'
* with a higher priority, it will execute before this plugin's logic.
*
* @param int $priority The default priority (22).
* @return int The modified priority.
*/
add_filter( 'uo_gf_pre_hooks_lesson_topic_priority', function( $priority ) {
// Example: If a specific condition is met, we might want to increase the priority
// to ensure our lesson topic logic runs earlier. Let's say we want it to run
// before any other 'gform_pre_render' hook that might exist with a priority of 10.
if ( defined( 'MY_CUSTOM_LESSON_TOPIC_PRIORITY' ) && MY_CUSTOM_LESSON_TOPIC_PRIORITY > 0 ) {
return MY_CUSTOM_LESSON_TOPIC_PRIORITY;
}
// Otherwise, return the default or the priority passed in.
return $priority;
}, 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/gf-lesson-topic-auto-complete.php:66
public static function run_frontend_hooks() {
if ( true === self::dependants_exist() ) {
/* ADD FILTERS ACTIONS FUNCTION */
add_filter( 'gform_tooltips', array( __CLASS__, 'add_mark_complete_tooltip' ), 15, 2 );
add_filter( 'gform_form_settings', array( __CLASS__, 'add_mark_complete_setting' ), 15, 2 );
add_filter( 'gform_pre_form_settings_save', array( __CLASS__, 'save_mark_complete_setting' ), 15 );
$uo_gf_pre_hook_priority = apply_filters( 'uo_gf_pre_hooks_lesson_topic_priority', 22 );
add_filter( 'gform_pre_render', array( __CLASS__, 'add_hidden_course_lesson_topic' ), $uo_gf_pre_hook_priority );
add_filter( 'gform_pre_validation', array( __CLASS__, 'add_hidden_course_lesson_topic' ), $uo_gf_pre_hook_priority );
add_filter( 'gform_pre_submission_filter', array( __CLASS__, 'add_hidden_course_lesson_topic' ), $uo_gf_pre_hook_priority );
add_filter( 'learndash_mark_complete', array( __CLASS__, 'remove_mark_complete_button_focus' ), 10, 2 );
add_filter( 'learndash_show_next_link', array( __CLASS__, 'learndash_show_next_link_progression' ), 10, 3 );
add_action( 'gform_after_submission', array( __CLASS__, 'maybe_mark_lesson_topic_complete' ), 99, 2 );
add_action( 'init', array( __CLASS__, 'is_save_and_continue' ), 99 );
add_action( 'gform_pre_submission', array( __CLASS__, 'pre_submission' ), 99, 1 );
}
}