Guest User

Untitled

a guest
Jun 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <?php
  2. /**
  3. * @file club_reg.module
  4. * TODO: Enter file description here.
  5. */
  6.  
  7. /**
  8. * Implements hook_menu().
  9. */
  10. function clug_reg_menu() {
  11. // This is the minimum information you can provide for a menu item.
  12. $items['club-reg'] = array(
  13. 'title' => 'Officer reg',
  14. 'page callback' => 'clug_reg_officer_register_form',
  15. 'access callback' => TRUE,
  16. );
  17.  
  18. return $items;
  19. }
  20.  
  21. function clug_reg_officer_register_form() {
  22.  
  23. $form['name'] = array(
  24. '#title' => 'username',
  25. '#description' => 'choose a username',
  26. '#type' => 'textfield',
  27. '#required' => TRUE,
  28. );
  29. $form['mail'] = array(
  30. '#title' => 'email',
  31. '#description' => 'enter a valid email address',
  32. '#type' => 'textfield',
  33. '#required' => TRUE,
  34. );
  35. $form['submit'] = array(
  36. '#type' => 'submit',
  37. '#value' => t('Save'),
  38. '#submit' => array('clug_reg_officer_register_form_submit'),
  39. );
  40.  
  41.  
  42. return $form;
  43.  
  44. }
  45.  
  46. function clug_reg_officer_register_form_submit($form, &$form_state){
  47. $edit = array(
  48. 'name' => $form_state['values']['name'],
  49. 'pass' => user_password(),
  50. 'mail' => $form_state['values']['mail'],
  51. 'init' => $form_state['values']['mail'],
  52. 'status' => 1,
  53. 'access' => REQUEST_TIME,
  54. );
  55. user_save(drupal_anonymous_user(), $edit);
  56. }
Add Comment
Please, Sign In to add comment