Skip to content

Commit

Permalink
Fixed: create token link in "invalid API token" error message didn't …
Browse files Browse the repository at this point in the history
…work.
  • Loading branch information
Dan0sz committed May 17, 2024
1 parent 102da20 commit 571c8dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,16 @@ private function validate_api_token( $token = '' ) {
$client = new Client( $token );

if ( ! $client->validate_api_token() ) {
$hosted_domain = Helpers::get_hosted_domain_url();
$domain = Helpers::get_domain();

Messages::set_error(
sprintf(
__(
'Oops! The Plugin Token you used is invalid. Please <a class="plausible-create-api-token hover:cursor-pointer underline">click here</a> to generate a new token. <a target="_blank" href="%s">Read more</a>',
'Oops! The Plugin Token you used is invalid. Please <a href="%s" target="_blank">create a new token</a>. <a target="_blank" href="%s">Read more</a>',
'plausible-analytics'
),
"$hosted_domain/$domain/settings/integrations?new_token=WordPress",
'https://plausible.io/wordpress-analytics-plugin#oops-the-token-you-used-is-invalid'
)
);
Expand Down

0 comments on commit 571c8dc

Please sign in to comment.