Closed (fixed)
Project:
Profile 2
Version:
7.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2012 at 13:22 UTC
Updated:
3 Oct 2012 at 13:31 UTC
Hi,
I would like to print some Profile2 fields in my node.tpl.php template.
What would be the best way to achieve this?
Thank you!
Comments
Comment #1
youssefr commentedDid you try this...
Comment #2
quasi commentedHello youssefr and thank you,
I tried your solution but it doesn't print out anything.
I changed the 'customer_profile' and the fields names.
Thank you again!
Comment #3
quasi commentedWere you able to print the fields in this way?
Comment #4
quasi commentedThis is how I got it working:
Thanks again youssefr for pointing me in the right direction!
Comment #5
quasi commentedComment #6
drupalina commentedHi,
I'm trying to do something similar: to print author's Telephone number (field_telephone) on node teasers of the nodes that they author.
I tried both examples:
They both work for authenticated users, but for user 1 it shows
and returns no values.
Please help.
Comment #7
drupalina commentedgot it working using
note the difference between $user->uid and $node->uid
Comment #8
faqing commenteddrupalina,
It only works for text feild, but does not work for node reference, term reference.
I mean if your "field_telephone" is a reference link (link to another node), the following is not working:
but change value to nid, it will pring node number.
Do you know how to render the reference node?
Comment #9
Number Nine commentedHello faqing,
I am using this code to render Profile2 text fields:
The thing is, I cannot apply what you indicate in your comment here above to render node references.
I tried something like this but it did not work:
print render($profile->field_name['und'][0]['nid']);Thank you for your help if you or anyone alse can.
Comment #10
faqing commentedHello,
We are discussing on printing profile fields on node.tpl.php template.
For user-node.tpl.php, check here
http://drupal.org/node/1178260
For node reference field and taxonomy field:
http://thanhsiang.org/faqing/node/178
Comment #11
Number Nine commentedThank you Faqing, I see your reply only now.
The project is in a stand-by position and will re-start soon.
Meanwhile I'll look into your suggested posts.