Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1085331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:40:33+00:00 2026-05-16T22:40:33+00:00

I have a content type (A) that references a single node of a different

  • 0

I have a content type (A) that references a single node of a different content type (B). The node referenced (B) can be programmatically determined using the information for the user creating this new node (A)… Each user can only create a single node of the referenced content type (B), so this single node will always be referenced from nodes of content type B that the user creates.

Because the referenced node is always known, I don’t want the user to have to enter the reference value, I want to set it for them behind the scenes. I’ve found a number of threads about doing this, but none seem to be clear or actually work for me.

Any help would be greatly appreciated.

Note: Drupal 6

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:40:33+00:00Added an answer on May 16, 2026 at 10:40 pm

    You can try:

    function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
       switch ($op) {
          case 'insert':
             if ($node->type == 'type_a') {
                $node->field_of_reference[0]['nid'] = 'node reference value';
                node_save($node);
             } 
             break;
       }
    }
    

    This should add the value to the node and save it after it has been created.

    http://api.drupal.org/api/function/hook_nodeapi

    Note: You will need to create a module to facilitate this. You can also try the Rules module, though, I am not sure it will do what you ask without a custom rule. But I know the above method will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several different content type nodes (videos, image galleries, stories...) that I would
I have a taxonomy attached with my content type. While creating node of that
I have a content type that references multiple nodes, and I need a way
I have an archetype content type that previously was not folderish. Now I have
I have a site content type that was used for a handful of lists
So here is the scenario... I have a sharepoint content type that calls a
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have to connect to a poorly implemented server that only understands Content-Type (capital-T)
I have a Drupal setup like this: Content type: Apartments Vocabulary: Areas , that
I have a content type Task, where we create task for ourself or user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.