|
@@ -29,9 +29,16 @@ function materio_user_menu(){
|
|
|
'file' => 'materio_user.pages.inc',
|
|
|
);
|
|
|
|
|
|
- $items['materio_user/register'] = $base+array(
|
|
|
+ $items['materio_user/registerblock'] = $base+array(
|
|
|
'title' => 'Materio base user ajax',
|
|
|
- 'page callback' => 'materio_user_register',
|
|
|
+ 'page callback' => 'materio_user_registerblock',
|
|
|
+ // 'page arguments' => array(),
|
|
|
+ 'access callback' => TRUE,
|
|
|
+ );
|
|
|
+
|
|
|
+ $items['materio_user/loginandregisterblock'] = $base+array(
|
|
|
+ 'title' => 'Materio base user ajax',
|
|
|
+ 'page callback' => 'materio_user_loginandregisterblock',
|
|
|
// 'page arguments' => array(),
|
|
|
'access callback' => TRUE,
|
|
|
);
|
|
@@ -65,6 +72,10 @@ function materio_user_menu_alter(&$items) {
|
|
|
* Implements hook_block_info().
|
|
|
*/
|
|
|
function materio_user_block_info() {
|
|
|
+ $blocks['user_createaccount'] = array(
|
|
|
+ 'info' => t('Create an account block'),
|
|
|
+ 'cache' => DRUPAL_NO_CACHE
|
|
|
+ );
|
|
|
$blocks['user_register'] = array(
|
|
|
'info' => t('Register block'),
|
|
|
'cache' => DRUPAL_NO_CACHE
|
|
@@ -88,6 +99,18 @@ function materio_user_block_view($delta = '') {
|
|
|
global $user, $language;
|
|
|
$block = array();
|
|
|
switch ($delta) {
|
|
|
+ case 'user_createaccount':
|
|
|
+ if(isset($user->roles[1])){
|
|
|
+ $block['subject'] = '';
|
|
|
+ if (drupal_is_front_page()) {
|
|
|
+ $block['content'] .= '<h3>'. t('Create your materiO\' account') . '</h3>';
|
|
|
+ $block['content'] .= l(t('Join us'), 'node/11187', array("attributes"=>array("class"=>array("join"))));
|
|
|
+ }else{
|
|
|
+ $block['content'] .= '<h3>'. t('Create your materiO\' account') . '</h3>';
|
|
|
+ $block['content'] .= drupal_render(drupal_get_form('user_register_form'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 'user_register':
|
|
|
if(isset($user->roles[1])){
|
|
|
$block['subject'] = '';//drupal_is_front_page() ? t('Your projects will born from here') : t('Create your materiO\' account');
|
|
@@ -127,7 +150,7 @@ function materio_user_block_view($delta = '') {
|
|
|
/**
|
|
|
* Implements hook_form_alter().
|
|
|
*/
|
|
|
-function DISABLED_NOT_FINISHED_materio_user_form_alter(&$form, &$form_state, $form_id) {
|
|
|
+function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
|
|
// dsm($form_id);
|
|
|
if( $form_id == "user_register_form" && !user_access('administer users') ){
|
|
|
// dsm($form);
|
|
@@ -143,7 +166,7 @@ function DISABLED_NOT_FINISHED_materio_user_form_alter(&$form, &$form_state, $fo
|
|
|
// '#required' => true,
|
|
|
// );
|
|
|
|
|
|
- $form['#submit'][] = "materio_user_user_register_form_submit";
|
|
|
+ // $form['#submit'][] = "materio_user_user_register_form_submit";
|
|
|
|
|
|
}
|
|
|
if($form_id == "user_login" ){
|
|
@@ -152,17 +175,17 @@ function DISABLED_NOT_FINISHED_materio_user_form_alter(&$form, &$form_state, $fo
|
|
|
$form['actions']['#type'] = "container";
|
|
|
// $form['actions']['submit']['#value'] = t('Join');
|
|
|
|
|
|
- if( $_GET['q'] == 'node/11187' ){
|
|
|
- $form['#submit'][] = "materio_user_user_login_form_submit";
|
|
|
- }
|
|
|
+ // if( $_GET['q'] == 'node/11187' ){
|
|
|
+ // $form['#submit'][] = "materio_user_user_login_form_submit";
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
|
|
|
- if( $form_id == "webform_client_form_11186" ){
|
|
|
+ // if( $form_id == "webform_client_form_11186" ){
|
|
|
// dsm($form, '$form');
|
|
|
- $form['#validate'][] = "materio_user_webform_client_111186_validate";
|
|
|
+ // $form['#validate'][] = "materio_user_webform_client_111186_validate";
|
|
|
// $form['#submit'][] = "materio_user_webform_client_111186_submit";
|
|
|
- }
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
// if( $form_id == "user_profile_form" ){
|
|
@@ -171,7 +194,7 @@ function DISABLED_NOT_FINISHED_materio_user_form_alter(&$form, &$form_state, $fo
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
-function materio_user_user_register_form_submit($form, &$form_state){
|
|
|
+// function materio_user_user_register_form_submit($form, &$form_state){
|
|
|
// dsm($form, 'form');
|
|
|
// dsm($form_state, 'form_state');
|
|
|
// dsm($_REQUEST, '$_REQUEST');
|
|
@@ -189,18 +212,18 @@ function materio_user_user_register_form_submit($form, &$form_state){
|
|
|
// $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)));
|
|
|
-}
|
|
|
+// }
|
|
|
|
|
|
-function materio_user_user_login_form_submit($form, &$form_state){
|
|
|
- unset($_REQUEST['destination'], $_REQUEST['edit']['destination']);
|
|
|
+// function materio_user_user_login_form_submit($form, &$form_state){
|
|
|
+// unset($_REQUEST['destination'], $_REQUEST['edit']['destination']);
|
|
|
|
|
|
- $form_state['redirect'] = array(
|
|
|
- 'node/11187',
|
|
|
- array(
|
|
|
- 'fragment' => 'content-bottom', // if we login from the membership page, then go directly to the form
|
|
|
- )
|
|
|
- );
|
|
|
-}
|
|
|
+// $form_state['redirect'] = array(
|
|
|
+// 'node/11187',
|
|
|
+// array(
|
|
|
+// 'fragment' => 'content-bottom', // if we login from the membership page, then go directly to the form
|
|
|
+// )
|
|
|
+// );
|
|
|
+// }
|
|
|
|
|
|
function materio_user_webform_client_111186_validate($form, &$form_state){
|
|
|
// dsm($form, 'form');
|