Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Engagements::add_actions()

Register all actions that trigger engagements


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.engagements.php

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
private function add_actions() {
 
    foreach ( $this->get_trigger_hooks() as $action ) {
        add_action( $action, array( $this, 'maybe_trigger_engagement' ), 777, 3 );
    }
 
    // Handlers are in charge of processing (awarding/sending) the email/cert/achievement.
    $handlers = array(
        'lifterlms_engagement_send_email'        => 'handle_email',
        'lifterlms_engagement_award_achievement' => 'handle_achievement',
        'lifterlms_engagement_award_certificate' => 'handle_certificate',
    );
    foreach ( $handlers as $action => $method ) {
 
        /**
         * Adds an action for the deprecated method so that `remove_action()` calls
         * on the old method will continue to remove the new method.
         *
         * When we *remove* the deprecated methods we can remove this logic.
         */
        add_action( $action, array( $this, $method ) );
 
        // If the above action has been completely removed this will be false and we won't add the new method callback.
        $priority = has_action( $action, array( $this, $method ) );
        if ( false !== $priority ) {
            // Remove the deprecated action.
            remove_action( $action, array( $this, $method ) );
            // Call the new action at the specified priority. If the old action was restored at a different priority this will retain that customization.
            add_action( $action, array( 'LLMS_Engagement_Handler', $method ), $priority );
        }
    }
 
    add_action( 'deleted_post', array( $this, 'unschedule_delayed_engagements' ), 20, 2 );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Moved the list of hooks to the get_trigger_hooks() method.
3.39.0 Added llms_rest_student_registered as action hook.
3.11.0 Unknown.
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.