Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Major
Category:
Task
Assigned:
Reporter:
Created:
3 Jun 2011 at 22:39 UTC
Updated:
30 May 2013 at 05:57 UTC
I have set up a basic profile using drupal core. Then I have separate profile2 types for different types of users, with fields that only pertain to each type of user.
I'd like to include the profile2 fields (or the entire profile2 profile) on the core user page - user-profile.tpl.php.
How do I do this? I am not using render($user_profile) to print out the entire core profile page -- I call each field separately.
Comments
Comment #1
a.siebel commentedsubscribe
Comment #2
mmilano commentedNot sure if this is the proper way to do it, but this worked for me.
Comment #3
fagoSomething like that should be done in the template preprocessor.
Comment #4
drupik commented#2 how to setup this? Its not working for me.
Comment #5
chandan.drupalchamp commentedYou can use like ...
Comment #6
gvanto commentedHey sorry to sound dumb but where is this template preprocessor? Which file should I create?
I've created a page--front.tpl.php before, for example to override the front page's template output file - what is the appropriate file to create for a profile2 profile?
Many thanks
gvanto
profile2 newbie
Comment #7
Dropper commentedLook on the page api.drupal.org - search for template_preprocess functions. There are preprocess functions for various templates. This is basic Drupal knowledge you should get to know.
Comment #8
faqing commentedmmilano, Thank you so much. #2 is working for me!
Comment #9
faqing commentedwe can close this. I think.
Comment #10
faqing commentedIt only works for 'TEXT" display, it does not support for References, List display.
Comment #11
faqing commentedFor node reference and taxonomy term reference, the easiest way:
Further info, see here:
http://thanhsiang.org/faqing/node/178
Comment #12
nbchip commentedI dont see answer on how to print and render entire profile2 profile in for example user-profile.tpl.php
After loading particular user profile
Is there a way to render Entire / Complete profile with all fields, at once, and not field by field.
thx.
Comment #13
infines commented#2 works, but I am getting errors for the fields I am pulling...
Notice: Undefined index: portfolio in include() (line 5 of /home/folioh/public_html/sites/all/themes/folioh3/templates/user-profile.tpl.php).
Notice: Trying to get property of non-object in include() (line 5 of /home/folioh/public_html/sites/all/themes/folioh3/templates/user-profile.tpl.php).
Solution?
Comment #14
infines commentedThis is what I'm using. Works like a charm. Note: "portfolio" is the name of my profile type.
print render($portfolio->field_title['und'][0]['value']);Comment #15
infines commentedI'm changing this to be a task to add to the docs.
Comment #16
infines commentedComment #17
infines commentedhttp://drupal.org/node/1892772
Comment #18
infines commentedComment #19
deggertsen commentedJust referencing this issue for anyone still struggling with this like I was.
#1887428: user-profile.tpl.php won´t get recognized to show my profile2 fields... maybe I´m missing something in the config? Please help.