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

Issue while closing Home URL change notice. #175

Closed
knit-pay opened this issue Mar 23, 2024 · 5 comments
Closed

Issue while closing Home URL change notice. #175

knit-pay opened this issue Mar 23, 2024 · 5 comments
Assignees

Comments

@knit-pay
Copy link
Contributor

knit-pay commented Mar 23, 2024

In Pronamic Pay version 9.7.1, when we change home URL, admin sees notice sometime like this.

Pronamic Pay — We noticed the WordPress home URL has changed from "https://dev.localdomain/wordpress-dev" to "http://dev.localdomain/wordpress-dev". Please verify the payment gateway settings. For example, you might want to switch between live and test mode or need to update an URL at the gateway to continue receiving payment status updates. Also keep an eye on pending payments to discover possible configuration issues.

when we try to close this box, box does not get closed. We are getting this error

Action failed. Please refresh the page and retry.

Is this a known issue? Is it already fixed in the new version?

@remcotolsma
Copy link
Member

This is not a known issue, i also can't reproduce this issue. Testen this on a fresh wp-env test environment with WordPress 6.4.3 and a production site also with WordPress 6.4.3. You can test this by going to /wp-admin/options.php and change the pronamic_pay_home_url option to a value other than the home option value. Perhaps the website in question has a problem with handling nonces?

if ( ! \wp_verify_nonce( $nonce, 'pronamic_pay_dismiss_home_url_change' ) ) {
\wp_die( \esc_html__( 'Action failed. Please refresh the page and retry.', 'pronamic_ideal' ) );
}

@github-project-automation github-project-automation bot moved this from In Progress to Todo in Pronamic Pay Mar 25, 2024
@remcotolsma remcotolsma moved this to In Progress in Pronamic Pay Mar 25, 2024
@rvdsteege
Copy link
Member

The 'Action failed' message also occurs if the new value for the URL is the same as the current value. This can occur if there are filters in play for the home option. Did you notice the difference in https:// and http:// in the mentioned URLs? You might want to update your site URL to https:// if it is now using http://.

@remcotolsma
Copy link
Member

Thanks, I suggest that we clarify the error messages:

if ( ! \wp_verify_nonce( $nonce, 'pronamic_pay_dismiss_home_url_change' ) ) {
\wp_die( \esc_html__( 'Action failed. Please refresh the page and retry.', 'pronamic_ideal' ) );
}
if ( ! \current_user_can( 'manage_options' ) ) {
\wp_die( \esc_html__( 'You don’t have permission to do this.', 'pronamic_ideal' ) );
}
$result = \update_option( 'pronamic_pay_home_url', \get_option( 'home' ) );
if ( false === $result ) {
\wp_die( \esc_html__( 'Action failed. Please refresh the page and retry.', 'pronamic_ideal' ) );
}

For example:

The security code (nonce) to verify your dismiss action expired or was invalid, please refresh and try again.

Unable to dismiss the home URL change because the home URL option could not be updated, please refresh and try again.

@knit-pay
Copy link
Contributor Author

The 'Action failed' message also occurs if the new value for the URL is the same as the current value. This can occur if there are filters in play for the home option. Did you notice the difference in https:// and http:// in the mentioned URLs? You might want to update your site URL to https:// if it is now using http://.

Yes, this error is getting occurred in the websites who are using http instead of https. When we try to close the box, we are getting this error. When we change the URL in settings from http to https. error goes away.

If you want to reproduce the error. Just change the https to http on any of your test website. You will not be able to close the box in this case.

remcotolsma added a commit that referenced this issue Mar 25, 2024
@remcotolsma
Copy link
Member

remcotolsma commented Mar 25, 2024

Thanks, for the update, this is already improved in 52e5d37. In this scenario, the following error occurred:

$result = \update_option( 'pronamic_pay_home_url', \get_option( 'home' ) );
if ( false === $result ) {
\wp_die( \esc_html__( 'Action failed. Please refresh the page and retry.', 'pronamic_ideal' ) );
}

Instead of \home_url() we now use \get_option( 'home' ), so that we always work with the unfiltered home URL link. You can of course still wonder whether it would not be better to also change the home URL to the 'https://' URL. Also improved the error messages in b1c50c2.

@github-project-automation github-project-automation bot moved this from Todo to Done in Pronamic Pay Mar 25, 2024
@remcotolsma remcotolsma assigned remcotolsma and unassigned knit-pay Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants