Merge pull request #12535 from woocommerce/fallbacks-for-endpoints
Fix lost password and account links
This commit is contained in:
commit
07932b4432
|
@ -23,9 +23,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
function wc_lostpassword_url( $default_url = '' ) {
|
||||
$wc_password_reset_url = wc_get_page_permalink( 'myaccount' );
|
||||
$lost_password_endpoint = get_option( 'woocommerce_myaccount_lost_password_endpoint' );
|
||||
|
||||
if ( false !== $wc_password_reset_url ) {
|
||||
return wc_get_endpoint_url( 'lost-password', '', $wc_password_reset_url );
|
||||
if ( false !== $wc_password_reset_url && ! empty( $lost_password_endpoint ) ) {
|
||||
return wc_get_endpoint_url( $lost_password_endpoint, '', $wc_password_reset_url );
|
||||
} else {
|
||||
return $default_url;
|
||||
}
|
||||
|
|
|
@ -2545,3 +2545,20 @@ function wc_get_rating_html( $rating ) {
|
|||
function wc_get_price_html_from_text() {
|
||||
return apply_filters( 'woocommerce_get_price_html_from_text', '<span class="from">' . _x( 'From:', 'min_price', 'woocommerce' ) . ' </span>' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logout endpoint.
|
||||
*
|
||||
* @since 2.6.9
|
||||
* @return string
|
||||
*/
|
||||
function wc_logout_url( $redirect = '' ) {
|
||||
$logout_endpoint = get_option( 'woocommerce_logout_endpoint' );
|
||||
$redirect = $redirect ? $redirect : wc_get_page_permalink( 'myaccount' );
|
||||
|
||||
if ( $logout_endpoint ) {
|
||||
return wc_get_endpoint_url( 'customer-logout', '', $redirect );
|
||||
} else {
|
||||
return wp_logout_url( $redirect );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
printf(
|
||||
__( 'Hello %1$s (not %1$s? <a href="%2$s">Sign out</a>)', 'woocommerce' ),
|
||||
'<strong>' . esc_html( $current_user->display_name ) . '</strong>',
|
||||
esc_url( wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) ) )
|
||||
esc_url( wc_logout_url( wc_get_page_permalink( 'myaccount' ) ) )
|
||||
);
|
||||
?></p>
|
||||
|
||||
|
|
Loading…
Reference in New Issue