0

i want to customize login block in a fancy login box.

i used this code in a template.php

function bootstrap_form_user_login_block_alter(&$form, &$form_state, $form_id) {
  $form['name']['#size'] = 30;
  $form['pass']['#size'] = 30;
  $markup = l(t('Forgot your password?'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $markup .= ' ' . l(t('Sign up'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'), 'class' => 'register-link')));
  }
  $markup = '<div class="clearfix">' . $markup . '</div>';
  $form['links']['#markup'] = $markup;
  $form['links']['#weight'] = 10000;
}

this code working fine, but on clicking singup link it giving error

Fatal error: [] operator not supported for strings in C:\xampp\htdocs\drupal\includes\common.inc on line 2445

How do I resolve it?

2
  • If you get this error after clicking the link, then obviously the code you've posted has nothing to do with the error. You're probably altering the login process incorrectly somewhere else.
    – Clive
    Apr 13, 2014 at 10:16
  • i have used logintoboggan module, does it affects anything..
    – asalug
    Apr 13, 2014 at 10:54

1 Answer 1

2

Looks like the problem is your class definition.

['attributes']['class'] should be an array but you are setting it as a string.

Your line:

$markup .= ' ' . l(t('Sign up'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'), 'class' => 'register-link')));

Should be:

$markup .= ' ' . l(t('Sign up'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'), 'class' => array('register-link'))));
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.