I have a content type with a CCK user reference that take 2 users. I wan to get the user profile data for each of those two and create "firstname1 lastname1 & firstname2 lastname2" in the computed field.
I'm a php/mysql n00b so even the basics need to be explained once we get under the hood. It would seem that if I could get the uid from the cck user field that I could use http://11heavens.com/Drupal-coder-lost-in-space/who-is-she user_load to get my custom profile firstname and lastname for each of the two users and then concatenate them into my computed field.
2 problems:
I can't seem to get at the UID's
I couldn't write the query once I got them.
Anyone want to lend a hand? Extensive searches have led me to think that an example like this does not exist, so it would be a great addition to the community.
Comments
I found another similar question
http://drupal.org/node/122768
With a little help I was able to accmplish what I wanted...
Thanks to "seutje" on #drupal-support on 20080114 for finally answering one of my pleas and getting me on the right track. I also had some example help from http://11heavens.com/Drupal-coder-lost-in-space/who-is-she.
I have a content type that is just a data storage for a view that I create. One of the items in the view is a cck user reference field that I allow for 2 users to be selected. I need to generate a collection of these views that are linked to a separate display view that takes 2 arguments. In order to get a link in the view to to the separate view that needs arguments, I could only think of one out one way to do it. Obviously there are many ways but for me it needed to be virtually code free. The way that I devised was to create a separate cck compute field to generate a title from the names and a url from the two arguments.
Getting custom profile data from the UID of a CCK user reference field:
With the uid I used this to get an array from that users profile:
The specific fields I wanted were first and last names:
Where profile_first & profile_last are the custom profile fields that I set up previously to hold those values.
Finally I was able to concatenate the name and make it into a href link: