Skip to content

Commit

Permalink
Camptix stats: move ticket viewing stat to separate option (#1424)
Browse files Browse the repository at this point in the history
* Camptix stats: move ticket viewing stat to separate option and avoid autoloading
  • Loading branch information
pkevan authored Oct 31, 2024
1 parent f83f4df commit 7e1d8d2
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion public_html/wp-content/plugins/camptix/camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,23 @@ function update_stats( $key, $value ) {
return;
}

/**
*
* Increments the stat used on the ticket form.
*
* @param $key
* @return void
*/
function increment_ticket_form_stat( $key ) {
if ( $key !== 'tickets_form_unique_visitors' ) {
return;
}
$viewing_stat = get_option( 'camptix_ticket_form_stat', 0 );
$viewing_stat++;
update_option( 'camptix_ticket_form_stat', $viewing_stat, 'no' );
return;
}

/**
* Increments a stats value.
*/
Expand Down Expand Up @@ -2482,7 +2499,7 @@ public function process_client_stats() {

switch ( $_REQUEST['command'] ) {
case 'increment':
$this->increment_stats( $_REQUEST['stat'] );
$this->increment_ticket_form_stat( $_REQUEST['stat'] );
wp_send_json_success();
break;
}
Expand Down

0 comments on commit 7e1d8d2

Please sign in to comment.