Categorías

Campo rol en el registro

Categoria:

Wordpress

Snippet:

//adding role select option on registration form
function wooc_extra_register_fields() {
 global $wp_roles; ?>
   <p class="form-row form-row-wide">
      <label for="reg_billing_phone">Select Role</label>
      
 roles as $key=>$value ) {
    // Exclude default roles such as administrator etc. Add your own
    if ( ! in_array( $value['name'], [ 'Administrator', 'Author', 'Editor', 'Shop Manager' ] ) ){
 echo ''.$value['name'].'';
    }
    	}
 ?>
      
   </p>
 $user_id, 'role' => $_POST['role'] ) );
}


Versiones:



Descripción:

Muestra un seleccionable de rol en e lproceso de registro.

Documentación:
https://zatackcoder.com/add-role-chooser-in-woocommerce-registration/



Code Snippets