Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @file club_reg.module
- * TODO: Enter file description here.
- */
- /**
- * Implements hook_menu().
- */
- function clug_reg_menu() {
- // This is the minimum information you can provide for a menu item.
- $items['club-reg'] = array(
- 'title' => 'Officer reg',
- 'page callback' => 'clug_reg_officer_register_form',
- 'access callback' => TRUE,
- );
- return $items;
- }
- function clug_reg_officer_register_form() {
- $form['name'] = array(
- '#title' => 'username',
- '#description' => 'choose a username',
- '#type' => 'textfield',
- '#required' => TRUE,
- );
- $form['mail'] = array(
- '#title' => 'email',
- '#description' => 'enter a valid email address',
- '#type' => 'textfield',
- '#required' => TRUE,
- );
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Save'),
- '#submit' => array('clug_reg_officer_register_form_submit'),
- );
- return $form;
- }
- function clug_reg_officer_register_form_submit($form, &$form_state){
- $edit = array(
- 'name' => $form_state['values']['name'],
- 'pass' => user_password(),
- 'mail' => $form_state['values']['mail'],
- 'init' => $form_state['values']['mail'],
- 'status' => 1,
- 'access' => REQUEST_TIME,
- );
- user_save(drupal_anonymous_user(), $edit);
- }
Add Comment
Please, Sign In to add comment