Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion classes/controllers/FrmUsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ class FrmUsageController {
* @return void
*/
public static function schedule_send() {
if ( wp_next_scheduled( 'formidable_send_usage' ) ) {
$timestamp = wp_next_scheduled( 'formidable_send_usage' );
if ( ! self::tracking_allowed() ) {
if ( $timestamp ) {
// Remove the scheduled event if it's not allowed and it's scheduled.
wp_unschedule_event( $timestamp, 'formidable_send_usage' );
}
return;
}

if ( $timestamp ) {
return;
}

Expand Down Expand Up @@ -56,6 +65,18 @@ public static function add_schedules( $schedules = array() ) {
return $schedules;
}

/**
* Checks if tracking is allowed.
*
* @since x.x
*
* @return bool
*/
public static function tracking_allowed() {
$settings = FrmAppHelper::get_settings();
return $settings->tracking;
}
Comment thread
Crabcyborg marked this conversation as resolved.

/**
* @since 3.06.04
*
Expand Down
3 changes: 1 addition & 2 deletions classes/models/FrmUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,7 @@ private function actions() {
* @return bool
*/
private function tracking_allowed() {
$settings = FrmAppHelper::get_settings();
return $settings->tracking;
return FrmUsageController::tracking_allowed();
}

/**
Expand Down