Advertisement
Guest User

Module

a guest
May 12th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.21 KB | None | 0 0
  1. Here's my module file:
  2.  
  3.     <?php
  4.  
  5.  
  6. /**
  7.  * Implements hook_menu().
  8.  */
  9.  
  10. /**
  11.  * Implements hook_menu_alter().
  12.  */
  13. function sparker_registration_menu_alter(&$items) {
  14.   // Ctools registration wizard for standard registration.
  15.   // Overrides default router item defined by core user module.
  16.   $items['user/register']['page callback'] = array('sparker_registration_ctools_wizard');
  17.   // Pass the "first" step key to start the form on step 1 if no step has been specified.
  18.   $items['user/register']['page arguments'] = array('register');
  19.   $items['user/register']['file path'] = drupal_get_path('module', 'sparker_registration');
  20.   $items['user/register']['file'] = 'sparker_registration_ctools_wizard.inc';
  21.  
  22.   return $items;
  23. }
  24.  
  25. /**
  26.  * Implements hook_menu().
  27.  */
  28. function sparker_registration_menu() {
  29.   $items['user/register/%'] = array(
  30.     'title' => 'Create new account',
  31.     'page callback' => 'sparker_registration_ctools_wizard',
  32.     'page arguments' => array(2),
  33.     'access callback' => 'sparker_registration_access',
  34.     'access arguments' => array(2),
  35.     'file' => 'sparker_registration_ctools_wizard.inc',
  36.     'type' => MENU_CALLBACK,
  37.   );
  38.  
  39.   return $items;
  40. }
  41.  
  42.  
  43. /**
  44.  * Implements hook_form_FORM_ID_alter().
  45.  */
  46. function sparker_registration_form_user_register_alter(&$form, &$form_state, $form_id) {
  47.   $form['#submit'] = array(
  48.     'user_register_submit',
  49.     'ctools_wizard_submit',
  50.   );
  51. }
  52.  
  53. /**
  54.  * Implements hook_block_view().
  55.  *
  56.  * This hook generates the contents of the blocks themselves.
  57.  */
  58. function sparker_registration_block_view($delta = '') {
  59.   switch ($delta) {
  60.     case 'register_step1':
  61.       $block['subject'] = 'Create an Account';
  62.       $block['content'] = sparker_registration_block_contents($delta);
  63.       break;
  64.   }
  65.   return $block;
  66. }
  67. /**
  68.  * A module-defined block content function.
  69.  */
  70. function sparker_registration_block_contents($which_block) {
  71.   global $user;
  72.   $content = '';
  73.   switch ($which_block) {
  74.     case 'register_step1':
  75.       if (!$user->uid) {
  76.         module_load_include('inc', 'sparker_registration', 'sparker_registration_ctools_wizard');
  77.         return sparker_registration_ctools_wizard('register');
  78.       }
  79.       break;
  80.   }
  81. }
  82.  
  83. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement