I created user-login.tpl.php file in my custom theme.

Then I add this code :

<div class="profile"<?php print $attributes; ?>>
  <h2><?php print ($user_profile['field_nom']);  ?></h2>
    <?php print_r($user_profile); ?>

It display my name correctly but, when I inspect in the browser its look like this ...

    <div class="field field-name-field-nom field-type-text field-label-above clearfix">

        <div class="field-label">My name:&nbsp;</div>

        <div class="field-items">
            <div class="field-item even">Branquet</div>


I just want to have the text, not a bunch of unless divs

  • have you tried this $user_profile['field_nom']['und'][0]['value'] ? – Shabir A. Dec 16 '15 at 15:38
  • It does not work – Corentin Branquet Dec 16 '15 at 15:41

One option is you can user php function in tpl file before print.


Refer http://php.net/manual/en/function.strip-tags.php

  • It does not work, I did this : $clean = strip_tags($user_profile['field_nom']); print render ($clean); – Corentin Branquet Dec 17 '15 at 10:20

Take a look at this page, there are numerous ways to do this. To render raw field value without any markup use $account-><YourFieldName>[LANGUAGE_NONE]

Another way to do this is to preprocess the profile object using template_preprocess_user_profile

Use any debugging tools to find the raw value of your field


You can use Semantic Views module to strip all the tags.

  • 1
    This module works along views module. Not for all tpl files. – DRUPWAY Dec 16 '15 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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