I want to change text of Create an account to

<div>something></div><span><a href="actual_link">Click here</a></span/>

When I print the form I got these values

[links] => Array
            [#markup] => <ul><li class="first"><a href="/user/register" title="Create a new user account.">Create new account</a></li>
<li class="last"><a href="/user/password" title="Request new password via e-mail.">Forgot your password?</a></li>

Also, I gave a try in settings.php like

$conf['locale_custom_strings_en'][''] = array(
  '"Create a new user account' => ' <div>somethifn></div><span><a href="actula link>Click here</a></span/>',

But this prints as a text.

Anybody can help?

  • why you dont try achieve it with jquery ?
    – Yuseferi
    Nov 12, 2014 at 8:50
  • Can you give the debug code of the form? (how you debug it? you say that the code is in settings.php??)
    – tvl
    Nov 12, 2014 at 10:46
  • As I understand you don't try to edit the login form, but the tab-menu of the login form.
    – tvl
    Nov 12, 2014 at 10:49
  • Hint: The string you are trying to replace is "Create a new user account, but Drupal uses Create a new user account.
    – apaderno
    Nov 12, 2014 at 11:49

3 Answers 3


The above mentioned problem can be easily solved by using hook_form_alter hook_form_alterhook_form_alter(&$form, &$form_state, $form_id) . You can use that function in our template.php of your custom theme .

In template.php write..

function custom_theme_form_alter(&$form, &$form_state, $form_id){
  if( $form['form_id']['#value'] === 'user_register_form'){// For registration form on 'user/register' page
    $form['actions']['submit']['#prefix'] = '<div class="test">';
    $form['actions']['submit']['#value'] = '--your text--';
    $form['actions']['submit']['#suffix'] = '</div>';
  if( $form['#id'] === 'user-login-form' ){  // For login block that comes with drupal core blocks and can be assigned to any region. 
    $form['links']['#markup'] = '<div class="item-list"><ul><li class="first"><a href="user/register" title="--your text--">--your text--</a></li>
<li class="last"><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li>

This will change your text from 'Create a new account' to your custom text. And don't forget to clear the cache :).

Reply on this thread if you still find some problem.


So lets assume you want to alter the tab-menu of the /user page.

First the dpm() doesn't work because you are logged out.

Then you must create a module, but if you are too lazy paste the code on the template.php of your theme and rename module with your theme's name.

Then debug the menu:

function module_menu_local_tasks_alter(&$data, $router_item, $root_path) {

After you find the title you want to edit your function:

function module_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  // The path of the array
  // Edit the actual array value
  $data['tabs'][0]['output'][0]['#link']['title'] = "My new title";

If you want to edit something in the login form:

function module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_login') {

I have solved the same problem with just two lines at the top in my page.tpl.php file,

<?php if($title == 'Create an account'):$title='whatever title you want';endif;  ?>

You can also include html tags to modify the title.

Thank you.


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.