In Drupal 7, there is a user login block. We can customize that block using the hook_form_FORM_ID_alter(). You can create a custom module or implement it directly in the theme template.php.
Here is a simple example written by Liam McDermott. You can add this in the template.php and replace THEMENAME by your theme name.
/** * Implements hook_form_FORM_ID_alter(). */ function THEMENAME_form_user_login_block_alter(&$form) { // For debug //drupal_set_message('<pre>' . check_plain(var_export($form, TRUE)) . '</pre>'); // Remove the links provided by Drupal. unset($form['links']); // Set a weight for form actions so other elements can be placed // beneath them. $form['actions']['#weight'] = 5; // Shorter, inline request new password link. $form['actions']['request_password'] = array( '#markup' => l(t('Lost password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.')))), ); // New sign up link, with 'cuter' text. if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) { $form['signup'] = array( '#markup' => l(t('Register - it’s free!'), 'user/register', array('attributes' => array('class' => 'button', 'id' => 'create-new-account', 'title' => t('Create a new user account.')))), '#weight' => 10, ); } }
Before you made any changes, i suggest you printing the $form array by uncommenting the the following line.
// For debug drupal_set_message('<pre>' . check_plain(var_export($form, TRUE)) . '</pre>');
Then you can add or unset anything you want after knowing what is stored in $form array.
Done =)
Reference: aPaddedCell – Get more sign-ups from Drupal 7: make ‘Create new account’ eye catching
This post help to me. Tnx very much!
LikeLike
Good to know that i can help. =D
LikeLike
Thanks for this! Very helpful!
LikeLike
you are welcome~ thanks for your comment. =)
LikeLike
Can you help me with facebook
LikeLike
These 2 posts may help
LikeLike
Thanks for this
LikeLike
you are welcome~ =)
LikeLike