disabled submit on registration to avoid duplicate account creation

This commit is contained in:
Bachir Soussi Chiadmi
2014-07-03 17:27:36 +02:00
parent f881f8b638
commit 0c71144833
4 changed files with 68 additions and 40 deletions
+20 -20
View File
@@ -1,4 +1,4 @@
<?php
<?php
/**
@@ -131,9 +131,9 @@ function materio_user_block_view($delta = '') {
if( (isset($user->roles[6]) || isset($user->roles[8])) && $user->created < strtotime('01-12-2012') ){
// dsm($user, 'user');
$block['subject'] = '';
$path = 'http://base.materio.com';
if($language->language == 'fr')
$path .= '/index_fr.html';
@@ -157,7 +157,7 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
// dsm($form);
$form['account']['pass']['#type'] = 'password';
$form['account']['pass']['#title'] = t('Password');
$form['actions']['#type'] = "container";
$form['actions']['submit']['#value'] = t('Join');
@@ -172,12 +172,12 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
}
if($form_id == "user_login" ){
// dsm($form);
$form['actions']['#type'] = "container";
// $form['actions']['submit']['#value'] = t('Join');
// if( $_GET['q'] == 'node/11187' ){
// $form['#submit'][] = "materio_user_user_login_form_submit";
// $form['#submit'][] = "materio_user_user_login_form_submit";
// }
}
@@ -209,7 +209,7 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
// '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');
// drupal_set_message(t('Welcome, you just join materiO\'! now you can choose the membership that\'s right for you, or !link', array('!link'=>$frontlink)));
@@ -241,13 +241,13 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
// TODO : tester si les email ne sont pas deja inscrit sur le site
form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
}
}
}
}
}
}
// function materio_user_webform_client_111186_submit($form, &$form_state){
@@ -263,7 +263,7 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
// // $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
// // // dsm($field_name, 'field_name');
// // form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
// // form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
// // }
// // }
// $userinfo = array(
@@ -281,9 +281,9 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
// // module_invoke_all('user_insert', $edit, $account);
// $i++;
// }
// }
// }
// enregistrer le type d'adonnement chez les user
@@ -299,7 +299,7 @@ function materio_user_help($path, $arg) {
if($arg[1] == 11187 ){
global $user;
// dsm($user, 'user');
if(isset($user->roles[1])){ // anonyme
$message = t('Please create first a free account and join materio or log in with your existing account,<br />then we\'ll provide you our membership form.', array());
$content = '<p>' . $message . '</p>';
@@ -340,16 +340,16 @@ function _materio_user_user_update(&$edit, $account, $category){
// dsm($edit, 'edit');
// dsm($account, 'account');
// dsm($category, 'category');
// This is only fired when a user confirms their email address, logintoboggan style
if (isset($account->logintoboggan_email_validated) && $account->logintoboggan_email_validated == TRUE) {
$confirmed_rid = materio_user_get_role_by_name(MATERIO_USER_CONFIRMED_USER_ROLE);
if (isset($account->logintoboggan_email_validated) && $account->logintoboggan_email_validated == TRUE) {
$confirmed_rid = materio_user_get_role_by_name(MATERIO_USER_CONFIRMED_USER_ROLE);
$roles = $account->roles + array($confirmed_rid => MATERIO_USER_CONFIRMED_USER_ROLE);
// we have to do this to stop an infinite loop, and also to allow lower weighted modules to possibly do something here
$user = $account;
unset($user->logintoboggan_email_validated);
user_save($user, array('roles' => $roles));
drupal_go_to('user/'.$user->uid.'/edit');
@@ -367,5 +367,5 @@ function _materio_user_user_update(&$edit, $account, $category){
*/
function materio_user_get_role_by_name($name) {
return array_search($name, user_roles());
}
}