Skip to content

Instantly share code, notes, and snippets.

/info

Created July 12, 2011 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1078330 to your computer and use it in GitHub Desktop.
Save anonymous/1078330 to your computer and use it in GitHub Desktop.
the reg form
name = reg_form
description = "the reg form."
version = "6.x-1.0"
core = "6.x"
project = "reg_form"
<?php
/**
* Implementation of hook_install().
*/
function formfilter_install() {
// Set a high weight so the module is called after other modules that
// modify forms.
db_query("UPDATE {system} SET weight = -99 WHERE name = 'reg_form'");
}
<?php
function reg_form_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == "user_register") {
//Look at the code in user_register_submit for all the ifs and switches to only
// add this extra handler when a normal user signs up.
$form['#submit'][] = "_reg_form_user_register_submit";
}
}
function _reg_form_user_register_submit($form, &$form_state) {
$form_state['redirect'] = $GET['q']; //Adds the current url as redirect.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment