As per title, I want to add an introduction text right after the Login / Register Form's title. Can anyone point me into the right direction on this?


JordanMagnuson’s picture

Check out this guide: http://drupal.org/node/19855 . The relevant part, if you scroll down to the Drupal 7 section is adding your intro text variable like so:

$variables['intro_text'] = t('This is my awesome login form');

Then in your template file you can print it out:

<p><?php print $intro_text; ?></p>

<div class="my-form-wrapper">
  <?php print $rendered; ?>

Note that adding a template file for the registration form (which has no theme hook associated with it) requires an extra step. See the first step at http://www.beyrent.net/blog/2011/05/theming-drupal-7-user-registration-form

Hope that helps.

akmalfikri’s picture

Hi there!

Thanks for replying.

This works if we login via user/login. On the same time, the site also have a login in Modal Form box. But the text did not shown there. Can someone point to me for this?

JordanMagnuson’s picture

Hm... that's strange. The text shows for me in the modal as well as non-modal, so I'm not sure what to suggest.

alexweber’s picture

Since this module just renders the form in a modal I don't see why wou wouldn't be able to just use a hook_form_alter() to add the extra markup you want.

JordanMagnuson’s picture

Yes, using hook_form_alter() is probably the easiest way. Something like:

$form['some_text'] = array(
          '#type' => 'item',
          '#markup' => '<p>Some text</p>,
          '#weight' => -100,
oksana-c’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Just like alexweber said above - this functionality is usually installed in template.php from current theme via hook_form_alter.
Marking this issue as "Closed (won't fix)" as this functionality should be achieved with other means than "Modal forms (with ctools)" module.

Code snippet below shows how to use hook_form_alter:

function yourtheme_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_login') {
    $form['#prefix'] = t('<h2>Your description goes here. HTML tags can also be used</h2>');
//to add description to registration form - replace form_id to 'user_register_form'.