diff --git a/src/Telemetry/Opt_In/Status.php b/src/Telemetry/Opt_In/Status.php index d6ba73a..4347b88 100644 --- a/src/Telemetry/Opt_In/Status.php +++ b/src/Telemetry/Opt_In/Status.php @@ -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. diff --git a/src/Telemetry/Telemetry/Telemetry.php b/src/Telemetry/Telemetry/Telemetry.php index 1238242..8a4f9a7 100644 --- a/src/Telemetry/Telemetry/Telemetry.php +++ b/src/Telemetry/Telemetry/Telemetry.php @@ -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. }