Posted by clarkburbidge on January 27, 2009 at 9:41am
Jump to:
| Project: | Content Profile |
| Version: | 6.x-1.0-beta3 |
| Component: | Base module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I am switching over to use content profile from the custom profile. I use computed field to generate some concatenated user info. On a separate node type from the content profile, I want to load the content profile array for a given UID. Then from this array I want to snatch what I want to mash up.
For the custom profile data I use:
user_load(array('uid' => $some_uid))
Is there some equivalent for content profile? It would seem that I'd need to load a node that corresponded to the UID.
Comments
#1
Just when I get past the point of breaking down and begging, somehow I'm able to figure it out.
In the computed field top code section I use:
content_profile_load('personal', $some_uid)
where 'personal" is my very original machine name for my content profile type. I get the UID from the cck user reference field and then call the array, get out what I want and mash it up.
Once again, great module!
#2
Closing.
#3
Could you elaborate--maybe post some of your code? I've been looking for a solution to this for some time. Thanks!
Patrick
#4
Sorry that it took me so long to get back to you. I didn't see your reply until just now.
$fighterRed_uid = $node->field_red_corner[0]['uid'];
$fighterBlue_uid = $node->field_blue_corner[0]['uid'];
$fighter1 = content_profile_load('personal', $fighterRed_uid);
$fighter2 = content_profile_load('personal', $fighterBlue_uid);
$fighter1_first = $fighter1->field_first_name[0]['value'];
$fighter1_last = $fighter1->field_last_name[0]['value'];
$fighter2_first = $fighter2->field_first_name[0]['value'];
$fighter2_last = $fighter2->field_last_name[0]['value'];
$node_field[0]['value'] = $fighter1_first." ".$fighter1_last." vs. ".$fighter2_first." ".$fighter2_last." </a>";
This computed field is on a "fight" content type. Each fight pairs 2 fighters, user references to two content profiles. In the fight node they are cck fields for the red corner and blue corner. To build the title I pull the uid from the user reference, then load that users "personal" content profile node. From that I grab the names and build the fight title.
Hope that helps you and is not too late!