5

The profile under user/n will only show the profile picture and the username.

I´m using an Omega subtheme. I´ve copied and pasted the default user-profile.tpl.php file, deleted everything and added these two lines, hoping that one of them would work:

print drupal_render(field_view_field('profile2', $profile['main'], 'field_nombrecompleto1'));
print $field_profile_nombre_completo['value'];

The second line refers to the original core profile field, and the first one refers to the imported field (I´ve imported using the migrate module in D6, before I´ve upgraded to D7).

None of the fields gets printed out. I´ve added this at the top of the template:

print "<pre>";  
$vars = get_defined_vars();
print_r($vars);  
print "</pre>";

And nothing happend. So I´ve added that code to the top of my page.tpl file, and it appeared the whole list of variables. At the very top it prints:

[template_file] => sites/all/themes/liga/templates/page.tpl.php

And at some points it actually recognizes the (core profile) field:

    [content] => Array
                                (
                                    [content] => Array
                                        (
                                            [system_main] => Array
                                                (
                                                    [field_profile_nombre_completo] => Array
                                                        (
                                                            [#theme] => field
                                                            [#weight] => 0
                                                            [#title] => Apellido y Nombres
                                                            [#access] => 1
                                                            [#label_display] => hidden
                                                            [#view_mode] => full
                                                            [#language] => und
                                                            [#field_name] => field_profile_nombre_completo
                                                            [#field_type] => text
...

I´ve then deleted everything at my user-profile template and printed just XXXXXX and it didn´t printed out. It stills print the profile image and the username.

Now I have two issues here: How to customize the profile template (user-profile.tpl.php) because it´s not recognizing the file inside my theme folder, and how to print profile2 fields information inside the user profile.

Hope anyone can give me some insight or clue. THANKS!!!

Rosamunda

11

I don´t know if I should respond to my own question, because after two days not only I didn´t received any answer (which isn´t bad in itself, because nobody "has" to answer), but I´ve received a minus one point, without ANY explanation at all, wich I think is rude.

Anyway, as I´ve found by myself the problem, and other people maybe has the same issue, and as a good citizen, I shall say that the it was the "Display Suite" module.

That module, wich is installed in more than 45.400 sites, was the only reason my Drupal installation didn´t recognized the user-profile.tpl.php file.

I´m going to read more carefully DS readme, tutorials ans screencasts out there because it´s a more complex module than I thought it was. But people should know that it does that (at least right out of the box, in a D7 installation with some core profile fields, Profile2 installed, and without any tweaks in the default configuration).

Cheers.

Rosamunda

3

you should copy core user_profile.tpl.php file to sites/all/theme/template. now its work perfectly. and you want to print profil2 field then you can find in $user_profile array. $user_profile array print all the data that are related to users.

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.