Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/event-hook-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
tarecord committed Sep 25, 2023
2 parents 97f6d32 + c125f1b commit 62cfd32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Telemetry/Opt_In/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
* @package StellarWP\Telemetry
*/
class Status {
public const OPTION_NAME = 'stellarwp_telemetry';
public const STATUS_ACTIVE = 1;
public const STATUS_INACTIVE = 2;
public const STATUS_MIXED = 3;
public const OPTION_NAME = 'stellarwp_telemetry';
public const OPTION_NAME_USER_INFO = 'stellarwp_telemetry_user_info';
public const STATUS_ACTIVE = 1;
public const STATUS_INACTIVE = 2;
public const STATUS_MIXED = 3;

/**
* Gets the option name used to store the opt-in status.
Expand Down
6 changes: 5 additions & 1 deletion src/Telemetry/Telemetry/Telemetry.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ public function register_user( string $stellar_slug = '' ) {
$stellar_slug = Config::get_stellar_slug();
}

$user_details = $this->get_user_details( $stellar_slug );

try {
$this->send( $this->get_user_details( $stellar_slug ), Config::get_server_url() . '/opt-in', false );
$this->send( $user_details, Config::get_server_url() . '/opt-in', false );
// Store the user info in the options table.
update_option( Status::OPTION_NAME_USER_INFO, $user_details, false );
} catch ( \Error $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
// We don't want to throw errors if the server fails.
}
Expand Down

0 comments on commit 62cfd32

Please sign in to comment.