Guest User

Untitled

a guest
Nov 20th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <section>
  2. <div>
  3. <?php
  4. $array_export_cvs = array();
  5. $array_export_cvs[] = array("Correo", "Nombre", "Cedula", "Departamento", "Ciudad", "Fecha de nacimiento");
  6. $args = array('role' => 'subscriber');
  7. $current_user = get_users( $args );
  8. foreach($current_user as $user){
  9. $full_name = get_user_meta($user->ID, 'pie_text_4', true) .' '. get_user_meta($user->ID, 'pie_text_3', true);
  10. $cedula = get_user_meta($user->ID, 'pie_text_36', true);
  11. $departamento = get_user_meta($user->ID, 'pie_text_11', true);
  12. $ciudad = get_user_meta($user->ID, 'pie_text_12', true);
  13. $fecha = get_user_meta($user->ID, 'pie_date_9', true);
  14. $fecha = $fecha[date];
  15. $array_export_cvs[] = array($user->user_email, $full_name, $cedula, $departamento, $ciudad, $fecha);
  16. echo(json_encode($array_export_cvs));
  17. }
  18. $fp = fopen('fichero.csv', 'w');
  19. foreach ( $array_export_cvs as $line ) {
  20. fputcsv($fp, $line,';');
  21. }
  22. fclose($fp);
  23. ?>
  24. <a class="btn btn-default" href="/fichero.csv" download="fichero.csv">Download</a>
  25. </div>
  26. </section>
  27.  
  28. ["usuario@email.com","Usuario Prueba","145127843","Departamento2","Ciudad3",["14/10/1991"]]
  29.  
  30. usuario@email.com;"Usuario Prueba";145127843;Departamento2;Ciudad3;Array
Add Comment
Please, Sign In to add comment