By tmetzger on
Hi folks,
I'm writing a module that creates a new "status" node type that models a relationship between a user and another node type. Basically:
User <-- Status Node --> Node
So now I'm writing hook_form for this new relationship node type. I want to tell drupal that the "user" field in this node points to a user (via uid), and that the "song" field points to a song node (via nid).
I've spent an hour looking through drupal documentation to find this, but no luck. Any suggestions?
Tom
Comments
RE:
Hey,
You can use cck module to create a new content type - "Status", and create two fields for this content type - user reference and node reference.
That way you can link between Status node, user and song node.
if this isn't helpful for you, please give more details of what is your goal, and i'll try to help.
Avoiding CCK
Thanks for the reply!
I'm avoiding CCK because my intention is to build this site once and then use it several more times via multisite, and building common stuff in the database instead of modules is going to complicate the maintenance I believe. I could be mistaken about that...
Anyway, I'm guessing that I need to write some code in the hook_form routine to grab the necessary items out of the database. For example, a query to retrieve usernames and user IDs, which I would pass into the select widget as options. True?
I wish there was a way to just call the user module and get a list of users that way, but I can't find anything like that in the documentation.