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

LICENS-45 Add auth logic #16

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
LICENS-45 Add link to upgrade notices
  • Loading branch information
MlKilderkin committed Jun 14, 2023
commit f97b9405a6574268cce10eaa72694884bf98dc04
12 changes: 11 additions & 1 deletion src/Uplink/API/Validation_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,17 @@ public function to_wp_format() {
if ( empty( $this->response->auth_required ) || $this->resource->has_valid_auth_token( $this->response->origin ) ) {
$info->download_link = isset($this->response->download_url) ? $this->response->download_url . '&pu_get_download=1' : '';
} else {
$info->api_invalid = esc_html__( 'Please connect plugin on Setting page in order to receive updates', '%TEXTDOMAIN%' );
$url = $this->origin->url;
$query_params = [
'callback_uri' => sprintf( '%s/stellarwp/connect', get_site_url() ),
'refer' => wp_get_referer(),
];
$url = sprintf( '%s?%s', $url, http_build_query( $query_params ) );

$info->api_upgrade = sprintf(
esc_html__( 'Please connect plugin on Setting page in order to receive updates. You can use plugin settings page or follow this <a href="%s">link</a>', '%TEXTDOMAIN%' ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit strange to not provide a link to the settings page. Should we just recommend they use the oauth_connect link and avoid referencing the plugin settings since implementations will be unique for each plugin? Here's what that could look like:

Suggested change
esc_html__( 'Please connect plugin on Setting page in order to receive updates. You can use plugin settings page or follow this <a href="%s">link</a>', '%TEXTDOMAIN%' ),
esc_html__( 'Please <a href="%s">authenticate this plugin</a> to receive updates.', '%TEXTDOMAIN%' ),

$url
);
$info->download_link = '';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Uplink/Admin/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function get_origin_url() {
$origin = $api->post('/origin', [ 'slug' => $license->get_slug() ] );

if ( ! empty( $origin ) ) {
return $origin->url;
return $origin->url . '/stellarwp_connect';
}

return '';
Expand Down