Skip to main content
added 336 characters in body
Source Link
krisbulman
  • 239
  • 4
  • 11

I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

screenshot

This seems simple, but I've been banging my head on it for a while and need input.

I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $items[] = l(t('Create a new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }
  $items[] = l(t('Forgot'Request Yournew Password?'password'), 'user/password', array('attributes' => array('title' => t('If you forgot your password, click to request a new password via e-mail.'))));
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes and allow for markup changes around the form, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.

I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

screenshot

This seems simple, but I've been banging my head on it for a while and need input.

I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.

I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

screenshot

I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }
  $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('If you forgot your password, click to request a new password via e-mail.'))));
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes and allow for markup changes around the form, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.

deleted 37 characters in body; edited title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

How todo I modify the login block markup? (D7)

GOAL: Change I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

Example: https://skitch.com/krisbulman/echee/welcome-to-d7.kgbdev.local-d7.kgbdev.localscreenshot

This SEEMSseems simple, but I've been banging my head on it for a while and need input.

SO FAR: I I am able to modify certain contents of the login block by using this function:.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This exampleThis example uses straight markup out of firebugFirebug and it does function: http://www.wdtutorials.com/drupal7/drupal-7-how-to-customize-user-login-form, but it seems there should be a cleaner way to do this by printing variables that already contain the markup.., and itthat doesn't remove the "Create new account" option if the site registration is restricted.

How to modify the login block markup? (D7)

GOAL: Change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

Example: https://skitch.com/krisbulman/echee/welcome-to-d7.kgbdev.local-d7.kgbdev.local

This SEEMS simple, but I've been banging my head on it for a while and need input.

SO FAR: I am able to modify certain contents of the login block by using this function:

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of firebug and it does function: http://www.wdtutorials.com/drupal7/drupal-7-how-to-customize-user-login-form but it seems there should be a cleaner way to do this by printing variables that already contain the markup.. and it doesn't remove the "Create new account" option if the site registration is restricted.

How do I modify the login block markup?

I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

screenshot

This seems simple, but I've been banging my head on it for a while and need input.

I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.

Tweeted twitter.com/#!/StackDrupal/status/235932587242164224
deleted 14 characters in body
Source Link
krisbulman
  • 239
  • 4
  • 11

GOAL: SwapChange the source order of the "Create new account"/"Forgot your password?" links withand the submitSubmit button, so the Submit button comes first.

Example: https://skitch.com/krisbulman/echee/welcome-to-d7.kgbdev.local-d7.kgbdev.local

This SEEMS simple, but I've been banging my head on it for a while and need input.

SO FAR: I am able to modify certain contents of the login block by using this function:

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of firebug and it does function: http://www.wdtutorials.com/drupal7/drupal-7-how-to-customize-user-login-form but it seems there should be a cleaner way to do this by printing variables that already contain the markup.. and it doesn't remove the "Create new account" option if the site registration is restricted.

GOAL: Swap the source order of the "Create new account"/"Forgot your password?" links with the submit button.

Example: https://skitch.com/krisbulman/echee/welcome-to-d7.kgbdev.local-d7.kgbdev.local

SO FAR: I am able to modify certain contents of the login block by using this function:

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of firebug and it does function: http://www.wdtutorials.com/drupal7/drupal-7-how-to-customize-user-login-form but it seems there should be a cleaner way to do this by printing variables that already contain the markup.. and it doesn't remove the "Create new account" option if the site registration is restricted.

GOAL: Change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

Example: https://skitch.com/krisbulman/echee/welcome-to-d7.kgbdev.local-d7.kgbdev.local

This SEEMS simple, but I've been banging my head on it for a while and need input.

SO FAR: I am able to modify certain contents of the login block by using this function:

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  $items[] = l(t('Create a new account'), 'user/register');
  $items[] = l(t('Forgot Your Password?'), 'user/password');
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

<div id="user-login-top">
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
 <?php print render($title_suffix); ?>
</div>
<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<div id="user-login-bottom" class="block-bottom"></div>

This example uses straight markup out of firebug and it does function: http://www.wdtutorials.com/drupal7/drupal-7-how-to-customize-user-login-form but it seems there should be a cleaner way to do this by printing variables that already contain the markup.. and it doesn't remove the "Create new account" option if the site registration is restricted.

deleted 14 characters in body
Source Link
krisbulman
  • 239
  • 4
  • 11
Loading
Source Link
krisbulman
  • 239
  • 4
  • 11
Loading