On http://mysite.my/ru/node/1/edit
Error: Fatal error: Call to undefined function node_load() in /home/vvs/projects/htdocs/mysite.my/sites/all/modules/languageinterface/languageinterface.module on line 119

CommentFileSizeAuthor
#2 undefined_node_load-1344652-2.patch394 bytesidflood

Comments

vood002’s picture

I'm getting the same error on node edit pages....if I refresh the page 4 or 5 times it goes away. Edit: On node/add pages as well

<?php
Fatal error: Call to undefined function node_load() in /var/www/drupal7/sites/all/modules/contrib/languageinterface/languageinterface.module on line 119
?>

Kind of perplexing...would appreciate any thoughts of what might be going on.

To save someone the trip...possibly...here's the function containing line 119 ( just below // find translation )

<?php
/**
 * This function returns link to content int target language.
 *
 * For nodes, this function checks whether the node has translation  to given language.
 * If yes, it returns such a link. If not, it returns link to current translation with menus translated to the other.
 *
 * For other content, this function returns link to translation.
 *
 * @param $lang language code to use
 */
function languagepath($lang) {
  $link = drupal_parse_url($_GET['q']);
  $link['absolute'] = TRUE;

  $languages = language_list();
  $link['language'] = $languages[$lang];

  if (!empty($url['language']->domain)) {
    $link['base_url']  = $url['language']->domain;
  }

  if (!empty($url['language']->prefix)) {
    $link['prefix']  = $url['language']->prefix;
  }

  if (arg(0) == 'node' && arg(1)) {
    $args = arg();
    array_shift($args); // remove "node" text
    $nid = array_shift($args);
    $rest = implode("/", $args);

    // find translation
    $node = node_load($nid);
    if ($node->tnid) {
      $nid = $node->tnid;
    }

    $nid = specific_translation_exist($nid, $lang);

    $link['path'] = 'node/' . $nid . '/' . $rest;
  }

  return $link;
}
?>
idflood’s picture

Title: Node edit » undefined function node_load on node edit page
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new394 bytes

I had the same issue. It happens because this is not called from a normal hook so the node module may not be loaded yet. Adding a manual 'module_load_include" fix the issue for me.

lklimek’s picture

Status: Needs review » Fixed

As I see no point in keeping this (quite trivial) patch open, I've committed the last patch to 7.x-1.x branch despite lack of formal community review ;). Should be downloadable soon.

Please test it because I don't have any environment set up where I could do that.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.