Questions tagged [drupal-node-hook]

hook_nodeapi() is the hook that on Drupal 6, and previous versions, acts on nodes.

hook_nodeapi() is the hook that on Drupal 6, and previous versions, acts on nodes.

In Drupal 7, it has been replaced from a family of hooks, such as hook_node_load(), hook_node_presave(), and hook_node_view().

See also

14 questions
4
votes
2 answers

How do I update a node (book or Page) before saving it without touching the module code in Drupal?

I would like to set some values in the node before actually writing the data to the DB. I already have it working by modifying book_nodeapi but I would like to do it from outside the code, some _alter option that allows me to leave the module code…
German
  • 43
  • 2
3
votes
1 answer

Set a custom message after saving a new node

Im trying to set a custom message that gets shown to users after they submit a new node. This message is going replace the standard '@type %title has been created.' I've tried using hook_nodeapi with $op of 'insert' but no matter how I try and…
Conor
  • 670
  • 1
  • 12
  • 27
3
votes
2 answers

How do I set the value for a CCK Node-reference field automatically when create form submits

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…
Chaulky
  • 699
  • 1
  • 8
  • 23
3
votes
1 answer

How can I load the title of parent item in Drupal

I want to extend Nodes with the title of the parentnode so I can display a hierarchy link. I have a solution that sometimes works: function modulename_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { switch ($op) { case 'view': …
wasigh
  • 895
  • 1
  • 11
  • 21
3
votes
1 answer

Drupal 5: CCK fields in custom content type

I have module that implements custom content type via NodeAPI hooks (hook_insert, hook_update etc). I want to add CCK field to this content type and populate it via hook_nodeapi calls like create or update (to show content nodes in Views). Problem…
Kuroki Kaze
  • 8,161
  • 4
  • 36
  • 48
2
votes
2 answers

Why isn't my drupal form submit function being called?

Ugh, this is probably something simple, but it is driving me crazy. I've got a simple form (just a submit button) that I am inserting into a node using hook_nodeapi(). It gets inserted correctly, and the page refreshes when I submit, but it is…
SenorPuerco
  • 871
  • 3
  • 9
  • 19
1
vote
2 answers

Drupal's hook_nodeapi matches operation 'update' before operation 'insert' when adding a new node

I'm working on a module, that make changes on nodes when adding new node, or when editing an existing nodes, but I have found that when adding a new node the hook_nodeapi's operation matches case "update" and case "insert", when it is assumed to…
Amir Iskander
  • 551
  • 1
  • 7
  • 21
1
vote
2 answers

Drupal cck checkbox with global setting

I am creating a "sticky" checkbox for my content type "news". this means that one news node is sticky, and is used in a banner like box. This is marked by a checkbox int the cck create content form. The checkbox is handled by the node_api, so I…
Nealv
  • 6,856
  • 8
  • 58
  • 89
0
votes
1 answer

2 nodes with the same path when creating one programatically during creation of first

I have some functionality on my site where when a journalist creates an article with multiple images to make a slideshow, they can check a box which will create a node of a type "gallery" which will then contain the images to be displayed as a…
Mark Cameron
  • 2,359
  • 2
  • 24
  • 29
0
votes
1 answer

Which node hook API shall I use? (Drupal 7)

I am working on a Drupal 6 to 7 site migration project. Many pages contain a custom token in [node-NID] format. The function of this custom token is to retrieve a node (identified by NID) body text. After migration to Drupal 7, the custom function…
Minghui Yu
  • 1,323
  • 2
  • 20
  • 27
0
votes
1 answer

Integrity constraint violation: 1062 Duplicate entry for Video Embed Field

Content Type :- VideoDisplay Fields:-Name of Video(Type: String), Video(Type: Video Embed Field), Artist(Type : Node Reference Field) User already created a record of type VideoDisplay.Now as per requirement I can add more Artist to Existing Video.…
simple user
  • 349
  • 3
  • 22
  • 44
0
votes
1 answer

Not saved image when creating content on Drupal 6

this problem: In the form of adding material has fields with images. Choose a file, click download, the file is loaded, the image is displayed. Others fill in the form and add material. The material is added, it's fine, but that's only the images…
Walik
  • 121
  • 3
0
votes
1 answer

Modify a node, when another node is being saved?

How to modify another node, when another node is being saved? i.e can I use a node_save($nid_to_be_saved) in side a hook_node_presave($node_being_saved)?
0
votes
1 answer

Drupal 6: how to execute php code when a specific node type is created

I googled it for a long time without sucess. I try in execute some php code when a new node of a specific type is created (or inserted) on my Drupal 6 web site. It seems I have to do something like that: function hook_nodeapi(&$node, $op, $a3 =…
rsahli
  • 1
  • 2