Method 1:
<?php /** * Implementation of hook_theme(). */ function my_blockGen_theme(&$existing, $type, $theme, $path) { global $theme; return array( 'user_login_block' => array( 'template' => 'templates/user_login_block', 'arguments' => array('form' => NULL), ), ); } function my_blockGen_preprocess_user_login_block(&$variables) { $variables['form']['links'] = array('#value' => ''); // remove "Request new password" link. $variables['user_login_block_rendered'] = drupal_render($variables['form']); ### [DEBUG] file_put_contents('/tmp/debug1', print_r($variables, TRUE) . PHP_EOL, FILE_APPEND); } ?>
Create a new template file under current module directory:
# touch /www/drupal6/sites/all/modules/custom/my_blockGen/templates/user_login_block.tpl.php
Edit my_blockGen/templates/user_login_block.tpl.php:
<?php print $user_login_block_rendered; ?>
Method 2:
<?php /** * Implementation of hook_preprocess_page(). */ function my_blockGen_preprocess_page(&$variables) { global $user; if (isset($_GET['q']) && $_GET['q'] === 'bg/cust_err403' && $user->uid == 0) { $variables['template_files'][] = 'user_login_block'; } } /** * Implementation of hook_form_alter(). */ function my_blockGen_form_alter(&$form, $form_state, $form_id) { if ($form_id === 'user_login_block') { $form['links'] = array('#value' => ''); // remove "Request new password" link. } } ?>
Create a new template file under current theme directory:
# touch /www/drupal6/sites/all/themes/mytheme/templates/user_login_block.tpl.php
Edit /www/drupal6/sites/all/themes/mytheme/templates/user_login_block.tpl.php:
<?php print $content_top; ?>
No comments:
Post a Comment