new membership and account creation process : modal and form is in a separated page

This commit is contained in:
Bachir Soussi Chiadmi
2013-10-30 17:53:15 +01:00
parent 051455cd71
commit 8909491a12
4 changed files with 239 additions and 50 deletions

View File

@@ -1,6 +1,14 @@
<?php
/**
* Implements hook_init().
*/
function materio_user_init() {
drupal_add_js(drupal_get_path('module', 'materio_user').'/js/materio_user.js');
}
/**
* Implements hook_permission().
*/
@@ -13,6 +21,38 @@ function materio_user_permission() {
);
}
function materio_user_menu(){
$items = array();
$base = array(
'type' => MENU_CALLBACK,
'file' => 'materio_user.pages.inc',
);
$items['materio_user/register'] = $base+array(
'title' => 'Materio base user ajax',
'page callback' => 'materio_user_register',
// 'page arguments' => array(),
'access callback' => TRUE,
);
$items['materio_user/register/submit'] = $base+array(
'title' => 'Materio base user ajax',
'page callback' => 'materio_user_register_submit',
// 'page arguments' => array(),
'access callback' => TRUE,
);
$items['materio_user/login/submit'] = $base+array(
'title' => 'Materio base user ajax',
'page callback' => 'materio_user_login_submit',
// 'page arguments' => array(),
'access callback' => TRUE,
);
return $items;
}
/**
* Implements hook_menu_alter().
*/
@@ -87,7 +127,7 @@ function materio_user_block_view($delta = '') {
/**
* Implements hook_form_alter().
*/
function materio_user_form_alter(&$form, &$form_state, $form_id) {
function DISABLED_NOT_FINISHED_materio_user_form_alter(&$form, &$form_state, $form_id) {
// dsm($form_id);
if( $form_id == "user_register_form" && !user_access('administer users') ){
// dsm($form);
@@ -131,60 +171,20 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
// }
}
// function materio_user_element_info() {
// return array(
// "new_password_confirm" => array(
// '#input' => TRUE,
// '#process' => array('materio_user_process_new_password_confirm'),
// '#theme_wrappers' => array('form_element'),
// ),
// );
// }
/**
* Expand a password_confirm field into two text boxes.
*/
// function materio_user_process_new_password_confirm($element) {
// $element['pass1'] = array(
// '#type' => 'password',
// '#title' => t('New password'),
// '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
// '#required' => $element['#required'],
// '#attributes' => array('class' => array('password-field')),
// );
// $element['pass2'] = array(
// '#type' => 'password',
// '#title' => t('Confirm password'),
// '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
// '#required' => $element['#required'],
// '#attributes' => array('class' => array('password-confirm')),
// );
// $element['#element_validate'] = array('password_confirm_validate');
// $element['#tree'] = TRUE;
// if (isset($element['#size'])) {
// $element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
// }
// return $element;
// }
function materio_user_user_register_form_submit($form, &$form_state){
// dsm($form, 'form');
// dsm($form_state, 'form_state');
// dsm($_REQUEST, '$_REQUEST');
// dsm($_GET, '$_GET');
unset($_REQUEST['destination'], $_REQUEST['edit']['destination']);
// unset($_REQUEST['destination'], $_REQUEST['edit']['destination']);
$form_state['redirect'] = array(
'node/11187',
array(
'fragment' => $_GET['q'] == 'node/11187' ? 'content-bottom' : '', // if we register from the membership page, then go directly to the form
)
);
// $form_state['redirect'] = array(
// 'node/11187',
// array(
// 'fragment' => $_GET['q'] == 'node/11187' ? 'content-bottom' : '', // if we register from the membership page, then go directly to the form
// )
// );
// $frontlink = l('continue with basic', '<front>');
// // drupal_get_messages('status');
@@ -206,7 +206,7 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
// dsm($form, 'form');
// dsm($form_state, 'form_state');
$values = $form_state['values']['submitted'];
if ($values['membership_options'] == 3) {
if ($values['column_left']['membership_options'] == 3) {
foreach ($values['collaborators'] as $coll_key => $coll) {
foreach ($coll as $field_key => $field_value) {
if($field_value == ''){
@@ -224,7 +224,6 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
}
}
// function materio_user_webform_client_111186_submit($form, &$form_state){