I support the Real Name module. In #324988: Support for Profile fields I have been asked to be able to use fields from from the Content Profile rather than the user profile. I have looked through the code and it is not immediately apparent to me how to access the fields. I think working this out will greatly benefit both modules (I see several issues in this queue that I could probably solve with Real Name.)

Comments

a_c_m’s picture

i think (and someone correct me if i'm wrong) its just a standard node with CCK fields, so you would need to get the CCK fields attached.

scottrigby’s picture

HI NancyDru...
The real name module is really helpful by the way (when using core profile fields) - it would be really great to see this work with content profile cck fields.
In my understanding - and limited experience with content profile -- the 'real name' is just one or more cck text fields.
I'll be happy to test as soon as there's something to work with ;)

nancydru’s picture

@a_c_m: Okay, so how do I get those fields?

Christopher Herberte’s picture

NancyDru
Check out the CCK API in particular content_fields() first you'll need to establish the node type that you're dealing with.
Content Profile is simply a mechanism to flag nodes as profiles.
Hope this helps.

Christopher Herberte’s picture

...or and Token

nancydru’s picture

Well, I did a search and have read the handbook pages, but I wouldn't say I found an API anywhere. To begin this quest, I need to have the field names and types, not just the content. Token doesn't help if I don't know what fields to look for.

If you can point me to better docs, I would appreciate it.

Christopher Herberte’s picture

get a keyed array of all the node types which are content profiles (requires content_profile.module)

print_r(content_profile_get_types('names'));

retrieve the field info for 'profile' node type (requires cck)

print_r(content_fields(NULL, 'profile'));

or

$type_info = content_types('profile');
print_r($type_info['fields']);

-- neither are documented as such but you can check the module's source for more info, i hope this helps.

nancydru’s picture

Thank you. That looks promising.

nancydru’s picture

Status: Active » Fixed

I'm very close to a complete solution. Thank you, Chris Herberte, for the code.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

mikedotexe’s picture

Man, it seems like this is what you want. It certainly was what I wanted.
Drupal - Content Profile Node from UID

$profile_node = content_profile_load('profile', $uid);

Then you can dsm it (if you have Devel installed, to see all the fields you want to look at.

dsm($profile_node) and grab it from there.

API call for Drupal 6:
http://drupalcontrib.org/api/drupal/contributions--content_profile--cont...