Fix account page for providing display_name edit
This commit is contained in:
parent
55b65d405e
commit
51948b7ae5
|
@ -204,20 +204,18 @@ class WC_Form_Handler {
|
|||
|
||||
$user->first_name = $account_first_name;
|
||||
$user->last_name = $account_last_name;
|
||||
$user->display_name = $account_display_name;
|
||||
|
||||
// Prevent emails being displayed, or leave alone.
|
||||
$user->display_name = is_email( $current_user->display_name ) ? sprintf( __( '%1$s %2$s', 'display name', 'woocommerce' ), $user->first_name, $user->last_name ) : $account_display_name;
|
||||
// Prevent display name change to email
|
||||
if ( is_email( $user->display_name ) ) {
|
||||
// Prevent display name to be changed to email
|
||||
if ( is_email( $account_display_name ) ) {
|
||||
wc_add_notice( __( 'Display name cannot be changed to email address due to privacy concern.', 'woocommerce' ), 'error' );
|
||||
$user->display_name = $current_user->display_name;
|
||||
}
|
||||
|
||||
// Handle required fields
|
||||
$required_fields = apply_filters( 'woocommerce_save_account_details_required_fields', array(
|
||||
'account_first_name' => __( 'First name', 'woocommerce' ),
|
||||
'account_last_name' => __( 'Last name', 'woocommerce' ),
|
||||
'account_display_name' => __( 'Display name publicly as', 'woocommerce' ),
|
||||
'account_display_name' => __( 'Display name', 'woocommerce' ),
|
||||
'account_email' => __( 'Email address', 'woocommerce' ),
|
||||
) );
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
|
|||
<div class="clear"></div>
|
||||
|
||||
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
|
||||
<label for="account_display_name"><?php esc_html_e( 'Display name publicly as', 'woocommerce' ); ?> <span class="required">*</span></label>
|
||||
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_display_name" id="account_display_name" value="<?php echo esc_attr( $user->display_name ); ?>" />
|
||||
<label for="account_display_name"><?php esc_html_e( 'Display name', 'woocommerce' ); ?> <span class="required">*</span></label>
|
||||
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_display_name" id="account_display_name" value="<?php echo esc_attr( $user->display_name ); ?>" /> <span><em><?php esc_html_e( 'This is how your name will appear in the account and in the review', 'woocommerce' ); ?></em></span>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue