Doesn't save data

FiNeX - October 28, 2007 - 19:29
Project:Edit Authoring Information
Version:5.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi! I've just downloaded and tested the module for the 5.x version. It shows the form right but after submit the data are not saved.
I've tested it on Drupal 5.3.

#1

FiNeX - November 7, 2007 - 22:41

After some testing, I've found the problem, there is a conflict with the taxonomy_access.module (if you don't use it, you are not affected by this "bug")

The taxonomy access module implements the hook_nodeapi() too. Here is the self explaining code of the function:

function taxonomy_access_nodeapi(&$node, $op, $arg = 0) {
  switch ($op) {
    case 'submit':
      // When TAC grants 'update' access to edit node,
      // Changing $node->uid back to original creator (changed by node_submit)
      if (($node->nid) && !user_access('administer nodes') &&
(node_access('update', $node))) {
        // Populate the "authored by" field.
        $old_node = node_load($node->nid);
        if ($account = user_load(array('name' => $old_node->name))) {
        //  $node->uid = $account->uid;
        }
        else {
          $node->uid = 0;
        }
      }
      break;

    case 'update':
      // restore terms that the user shouldn't have access to delete
      taxonomy_access_restore_terms($node->nid, $node->tac_protected_terms);
      break;
  }
}

As you can see from the code, if an user doesn't have the "administer nodes" permission but he can update the node thanks to the taxonomy access control, $node->uid is set to the old value.

Someone has some hints?

 
 

Drupal is a registered trademark of Dries Buytaert.