WooFrance Dépannage et support WordPress WooCommerce Forums Forum de Support WooCommerce WooCommerce – changer utilisateur en prénom

Affichage de 1 message (sur 1 au total)
  • Auteur
    Messages
  • #424956
    fournisseurs
    Participant
    Points: 13 pts

    Bonjour,

    je souhaiterais lors de la création d’un compte que le client puisse rentrer son prénom, son adresse mail et son mot de passe.

    Actuellement, nous avons déjà ce système en place sauf que quand le client rentre le prénom, c’est le champs utilisateur qui se rempli dans le back office de son compte. Comment faire pour changer ça.

    Je ne sais pas si je suis bien clair.

    Voici le code de notre page login.php :

    Merci d’avance

    <?php

    /**

    * Login Form

    *

    * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-login.php.

    *

    * HOWEVER, on occasion WooCommerce will need to update template files and you

    * (the theme developer) will need to copy the new files to your theme to

    * maintain compatibility. We try to do this as little as possible, but it does

    * happen. When this occurs the version of the template file will be bumped and

    * the readme will list any important changes.

    *

    * @see     https://docs.woocommerce.com/document/template-structure/

    * @package WooCommerce\Templates

    * @version 4.1.0

    */

     

    if ( ! defined( ‘ABSPATH’ ) ) {

    exit; // Exit if accessed directly.

    }

     

    $notices = wc_get_notices();

    wc_set_notices( $notices );

     

    if(array_key_exists(‘username’, $_POST) AND array_key_exists(’email’, $_POST) AND array_key_exists(‘password’, $_POST)) {

    if(username_exists(strip_tags($_POST[‘username’]))) {

    wc_add_notice(‘Ce nom d\’utilisateur existe déjà’);

    } elseif(email_exists(strip_tags($_POST[’email’]))) {

    wc_add_notice(‘Un utilisateur avec cet email existe déjà’);

    } elseif(empty($_POST[‘password’])) {

    wc_add_notice(‘Un mot de passe est obligatoire’);

    }

    }

     

    do_action( ‘woocommerce_before_customer_login_form’ ); ?>

     

    Mon compte Connexion

     

    <?php wc_print_notices(); ?>

     

    Nouveau Client

     

    <form method=”post” class=”woocommerce-form woocommerce-form-register register” <?php do_action( ‘woocommerce_register_form_tag’ ); ?> >

     

    <?php do_action( ‘woocommerce_register_form_start’ ); ?>

     

    <?php if ( ‘no’ === get_option( ‘woocommerce_registration_generate_username’ ) ) : ?>

     

    <input type=”text” class=”woocommerce-Input woocommerce-Input–text input-text” placeholder=”Prénom” name=”username” id=”reg_username” autocomplete=”username” value=”<?php echo ( ! empty( $_POST[‘username’] ) ) ? esc_attr( wp_unslash( $_POST[‘username’] ) ) : ”; ?>” /><?php // @codingStandardsIgnoreLine ?>

     

    <?php endif; ?>

     

    <input type=”email” class=”woocommerce-Input woocommerce-Input–text input-text” placeholder=”Adresse Mail” name=”email” id=”reg_email” autocomplete=”email” value=”<?php echo ( ! empty( $_POST[’email’] ) ) ? esc_attr( wp_unslash( $_POST[’email’] ) ) : ”; ?>” /><?php // @codingStandardsIgnoreLine ?>

     

    <?php if ( ‘no’ === get_option( ‘woocommerce_registration_generate_password’ ) ) : ?>

     

    <input type=”password” class=”woocommerce-Input woocommerce-Input–text input-text” placeholder=”Mot de passe” name=”password” id=”reg_password” autocomplete=”new-password” />

     

    <?php else : ?>

     

    <?php esc_html_e( ‘A link to set a new password will be sent to your email address.’, ‘woocommerce’ ); ?>

     

    <?php endif; ?>

     

    <?php do_action( ‘woocommerce_register_form’ ); ?>

     

    <?php wp_nonce_field( ‘woocommerce-register’, ‘woocommerce-register-nonce’ ); ?>

    <button type=”submit” class=”woocommerce-Button woocommerce-button button woocommerce-form-register__submit” name=”register” value=”<?php esc_attr_e( ‘Register’, ‘woocommerce’ ); ?>”><?php esc_html_e( ‘Register’, ‘woocommerce’ ); ?></button>

     

    <?php do_action( ‘woocommerce_register_form_end’ ); ?>

     

    </form>

     

    Déjà Client

     

    <form class=”woocommerce-form woocommerce-form-login login” method=”post”>

     

    <?php do_action( ‘woocommerce_login_form_start’ ); ?>

     

    <input type=”text” class=”woocommerce-Input woocommerce-Input–text input-text” placeholder=”Adresse Mail” name=”username” id=”username” autocomplete=”username” value=”<?php echo ( ! empty( $_POST[‘username’] ) ) ? esc_attr( wp_unslash( $_POST[‘username’] ) ) : ”; ?>” /><?php // @codingStandardsIgnoreLine ?>

    <input class=”woocommerce-Input woocommerce-Input–text input-text” placeholder=”Mot de passe” type=”password” name=”password” id=”password” autocomplete=”current-password” />

     

    <?php do_action( ‘woocommerce_login_form’ ); ?>

     

    <label class=”woocommerce-form__label woocommerce-form__label-for-checkbox woocommerce-form-login__rememberme”>

    <input class=”woocommerce-form__input woocommerce-form__input-checkbox” name=”rememberme” type=”checkbox” id=”rememberme” value=”forever” /> <?php esc_html_e( ‘Remember me’, ‘woocommerce’ ); ?>

    </label>

    <?php wp_nonce_field( ‘woocommerce-login’, ‘woocommerce-login-nonce’ ); ?>

    <button type=”submit” class=”woocommerce-button button woocommerce-form-login__submit” name=”login” value=”<?php esc_attr_e( ‘Log in’, ‘woocommerce’ ); ?>”><?php esc_html_e( ‘Log in’, ‘woocommerce’ ); ?></button>

    “><?php esc_html_e( ‘Lost your password?’, ‘woocommerce’ ); ?>

     

    <?php do_action( ‘woocommerce_login_form_end’ ); ?>

     

    </form>

     

    <?php do_action( ‘woocommerce_after_customer_login_form’ ); ?>

    depanagewp
Affichage de 1 message (sur 1 au total)
  • Vous devez être connecté pour répondre à ce sujet.