Skip to content

Commit

Permalink
Update lost password URL for WP 4.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
robincornett committed Sep 28, 2020
1 parent 68587de commit 56e1d5e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion includes/login-register.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,21 @@ function edd_login_register_error_message( $errors, $redirect ) {
* @return string
*/
function edd_get_lostpassword_url() {
$url = wp_get_raw_referer();
$url = false;
// `wp_get_raw_referer` was added in WP 4.5; this check is required as we still support 4.4.
if ( function_exists( 'wp_get_raw_referer' ) ) {
$url = wp_get_raw_referer();
} else {
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
$url = wp_unslash( $_REQUEST['_wp_http_referer'] );
} elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
$url = wp_unslash( $_SERVER['HTTP_REFERER'] );
}
}
if ( empty( $url ) ) {
$url = edd_get_checkout_uri();
}
$url = wp_validate_redirect( $url );
$redirect = add_query_arg(
array(
'checkemail' => 'confirm',
Expand Down

0 comments on commit 56e1d5e

Please sign in to comment.