register block : redirection to membership
register help messages Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
5a82c8394d
commit
ca2ebbf0c8
@ -47,7 +47,7 @@ function materio_user_block_view($delta = '') {
|
||||
switch ($delta) {
|
||||
case 'user_register':
|
||||
if(isset($user->roles[1])){
|
||||
$block['subject'] = t('Your projects will born from here');
|
||||
$block['subject'] = drupal_is_front_page() ? t('Your projects will born from here') : t('Create your materiO\' account');
|
||||
$block['content'] = drupal_render(drupal_get_form('user_register_form'));
|
||||
}
|
||||
break;
|
||||
@ -61,7 +61,7 @@ function materio_user_block_view($delta = '') {
|
||||
if($language->language == 'fr')
|
||||
$path .= '/index_fr.html';
|
||||
|
||||
$block['content'] = l(t('return to the old database'), $path);
|
||||
$block['content'] = l(t('Old database'), $path);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -85,11 +85,58 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
||||
|
||||
$form['termsofservices'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('I red and accept') .' '. l('the materiO terms of services', 'node/11183'),
|
||||
'#title' => t('I accept') .' '. l('the materiO terms of services', 'node/11183'),
|
||||
'#required' => true,
|
||||
);
|
||||
|
||||
$form['#submit'][] = "materio_user_user_register_form_submit";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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']);
|
||||
|
||||
$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');
|
||||
// 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)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function materio_user_help($path, $arg) {
|
||||
// dsm($path, 'path');
|
||||
// dsm($arg, 'arg');
|
||||
switch ($path) {
|
||||
case 'node/%':
|
||||
if($arg[1] == 11187 ){
|
||||
global $user;
|
||||
// dsm($user, 'user');
|
||||
|
||||
if(isset($user->roles[1])){ // anonyme
|
||||
$message = t('Please create an account and join materio, then we\'ll provide you the membership form.');
|
||||
$content = '<p>' . $message . '</p>';
|
||||
return $content;
|
||||
}else if(isset($user->roles[2])){ // authentificated user (not utilisateur)
|
||||
$content = '<h2>' . t('Welcome, you just joined materiO\' !') . '</h2>';
|
||||
$frontlink = l('continue with basic', '<front>');
|
||||
$message = t('Now you can choose the membership that\'s right for you, or !link', array('!link'=>$frontlink));
|
||||
$content .= '<p>' . $message . '</p>';
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user