Download & Extend

Call to undefined function node_add()

Project:Track
Version:6.x-0.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Visiting the Drupal path track/add results in this error message:

Fatal error: Call to undefined function node_add() in /home/drupal/sites6/any/modules/_geo/track/track.module on line 25

My guess is that it's an issue with 5.x to 6.x upgrades. I found these two things in the module upgrade notes that seem related:
http://drupal.org/node/114774#module_load_include
http://drupal.org/node/114774#node_add_summary

Comments

#1

I get the same error when I click on "Track list | Track upload" on the Navigation menu. Apparently, this menu item calls the wrong URL: "track/add".

I fixed the problem on my site by disabling the ""Track upload" menu item and creating a new one to replace it. My new menu item is "Upload a track" and this calls the URL "node/add/track".

#2

Confirmed bug, thanks!

#3

It appears the function does not exist, because the module has not yet been loaded.

Simply include this code snippet, straight before node_add().

if( ! function_exists("node_add")) {
include_once(drupal_get_path('module', 'node') . '/node.pages.inc');
}

#4

#5

Hi,

I added this code to the beginning of 'sites/all/modules/track/track.module' and it works fine:

module_load_include('inc', 'node', 'node.pages');
nobody click here