Let's take this circumstance:

  1. We are on a child node edit form: URL node/2365/edit
  2. We submit the form

I'm expecting to have the parent tokens [parent-*] correctly calculated after submitting the form. As an example I get wrong titles using the Automatic Nodetitles when using [parent-*] tokens in title pattern. All [parent-*] tokens are empty.

This is happen because the $node->parent_node is wrong calculated in

function relativity_nodeapi(&$node, $op, $teaser, $page) {
  if (is_numeric(arg(4))) {
    //check if parent node actually exists
    if (db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE nid=%d", arg(4)))) {
      if (array_key_exists(arg(2), relativity_node_list())) {
        $node->parent_node = arg(4);
      }
    }
  }
  elseif ($_POST['parent_node']) {
    $node->parent_node = $_POST['parent_node'] + 0;
  }

...

In our case (URL node/2365/edit) neither arg(4) or $_POST['parent_node'] are set to match the parent node.

Here's a patch that fixes this bug.

Comments

claudiu.cristea’s picture

Ticket http://drupal.org/node/569386 deal with this.

claudiu.cristea’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
StatusFileSize
new1.55 KB

Reworked patch against DRUPAL-6--1.

claudiu.cristea’s picture

Assigned: claudiu.cristea » Unassigned
Issue summary: View changes