I might be thinking about this the wrong way, so I want to run it by the forum and see what turns up...
I have a CCK field (text/multiline) on the user profile content type. This field stores the "Author Bio" for a user (a two sentence mini bio). Only some users will have this field filled in, so most users will not put anything into it.
I need to reference this field in another content type and put the author's bio at the bottom (of the node's body) of anything they post that is of that specific content type. I have no idea how to do this. Is there a way to do it all with CCK (some kind of field reference on the content type that will actually display the field)? Is this going to be done in the theme? I'm a little lost and need some guidance here.
So, to sum up...
Content type #1 (User Profile) has a field that I need to reference in content type #2 (call it News Story) whenever a user posts something using content type #2.
Any help is greatly appreciated. Thanks!
Comments
Field reference is probably what you want.
On the Story content type you would probably need to add a field reference to profile content types (you may need to create a view to populate the field options).
From there you can either use panels/views to output the bio in the Story (as in a node view variant) or simply render it from info passed in to the Story node template. I prefer the panels/views configuration...
I do think the field reference is what you need though.
Cheers, Derek
The question is tagged at 6.x
The question is tagged at 6.x and field reference is D5.x only so this won't work. Look at the computed field module: http://drupal.org/project/computed_field. In the computed field you need to write the code to obtain the node author and extract the bio field, but that should be pretty simple.
I meant node reference
I meant node reference field... sorry.
Yes I think node reference
Yes I think node reference and computed field should do it.
I found this...
http://drupal.org/node/290443
I'm having trouble with the SQL query. To be honest, I haven't had to write one that referenced Drupal fields/tables before. Any suggestions?
My field is field_author_bio and the content type is uprofile, but I don't know how to construct the query. Basically, if the author of the story content type matches the author of the uprofile content type, I want the field_author_bio to be printed on the story entry. I don't want it saved to the database, however (not sure if this changes things) because it needs to update on the fly whenever the story node(s) written by the user are loaded.
Thanks!
Figured it out...
http://drupal.org/node/527690#comment-3018232
Basically...
Note that...
$author_bio
field_author_bio
...are specific to my site. I want to have a sentence or two for each user that will be displayed on the nodes of certain content types that they create. My computed field for this is called "field_author_bio_display", and it is grabbing the information in the "field_author_bio" field on the user's Content Profile node.
A nodereference field was not required, since I'm grabbing the author of the node itself.
_
The only problem seems to be with content_profile_load()...
Every time a node with my new computed field for the author bio (field_author_bio_display) is viewed, it loads and displays the entire contents of the author's content profile page. If I refresh, that all goes away and only the value of the single field that I wanted is there. If I view another node with the field, same thing.
I wonder... must I use content_profile_load()?
Is there another way to do this?
Is this a bug with Content Profile?
Also need solution for this issue
Any solution for this issue?
I also need this, my field is taxonomy content with hierarchy select in Content Profile (field_location). I want a hierarchy select field in another node type is automatically fulfilled from this value. (Sorry for my broken English)
Any help is greatly appreciated. Thanks!