By daniel sanchez on
I'm not sure if this is the right place for this question.
I'm using Node Profile to create a custom user account page.
I want to print the first and last names of users on a different page.
I've named the fields field_last_name and field_first_name.
So I'd like to:
print $field_first_name . " " . $field_last_name;
But I don't know how to access those two variables.
I know I can access user's User name and Id using
global $user;
print $user->name . $user->id;
Thank you for any help you can give me.
Comments
The fields should be under
The fields should be under $node, so for example $node->field_first_name
They are stored as arrays.
You'll have to do a node_load first, if you're not currently displaying the appropriate node.
Use the var_dump function in your code to take a look at the contents of a variable and find what you want:
You'll have to find the $nid that is tied to the relevant user... and for that I guess you'll have to look at how Node Profile relates users and nodes...
Hope that helps!
__________________________________________________________
Mark Theunissen
Code Baboon
Drupal based services
Have you considered using
Have you considered using the Views module for this purpose?
__________________________________________________________
Mark Theunissen
Code Baboon
Drupal based services
me too, i have the same
me too, i have the same prblm and i have used the view, it work well but i want is a Php code so that i can print it inside my page or story or somewhere else!
So if you have idea, thanks alot!
Niaina
You should use
You should use function
nodeprofile_load($type, $uid)
for example
Julia
Thanks
I use the code that you give Julia and it going on well!
Thank you verry much indeed!
Niaina
Equivalent to nodeprofile_load for the module CONTENT PROFILE?
Hi!
Can anybody help me telling me what is the equivalent function to nodeprofile_load (valid for the module node profile) for the module content profile?
Thanks in advance,
Gabriel