Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #81 #83

Merged
merged 5 commits into from
Jul 9, 2024
Merged
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
10 changes: 6 additions & 4 deletions includes/component/tracking-data/ts-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ public function __construct( $ts_plugin_prefix = '', $ts_plugin_name = '', $ts_b
public static function ts_plugin_action_links ( $links ) {

$ts_action_links = array();
$nonce = wp_create_nonce( 'ts_nonce_action' );

if ( 'unknown' != get_option( self::$plugin_prefix . '_allow_tracking', 'unknown' ) ) {

$ts_action = self::$ts_settings_page . "?ts_action=reset_tracking";
$ts_action = self::$ts_settings_page . '?ts_action=reset_tracking&nonce=' . $nonce;

$ts_action_links = array(
'reset_tracking' => '<a href="'.$ts_action.'" class="reset_tracking" title= "This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data.">Reset Usage Tracking</a>',
Expand Down Expand Up @@ -168,11 +169,12 @@ public static function ts_add_new_settings_field ( $ts_settings ) {
* It will delete the tracking option from the database.
*/
public static function ts_reset_tracking_setting () {

if ( isset ( $_GET [ 'ts_action' ] ) && 'reset_tracking' == $_GET [ 'ts_action' ] ) {
$nonce = isset( $_GET ['nonce'] ) ? $_GET['nonce'] : '';//phpcs:ignore
if ( is_user_logged_in() && current_user_can( 'manage_options' ) && wp_verify_nonce( $nonce, 'ts_nonce_action' ) && ( isset( $_GET ['ts_action'] ) && 'reset_tracking' === $_GET ['ts_action'] ) ) {
delete_option( self::$plugin_prefix . '_allow_tracking' );
delete_option( self::$plugin_prefix . '_ts_tracker_last_send' );
$ts_url = remove_query_arg( 'ts_action' );
$ts_params = array( 'ts_action', 'nonce' );
$ts_url = remove_query_arg( $ts_params );
wp_safe_redirect( $ts_url );
}
}
Expand Down
Loading