/[drupal]/drupal/modules/node/node.module
ViewVC logotype

Diff of /drupal/modules/node/node.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1009 by dries, Sun Jan 4 19:56:51 2009 UTC revision 1.1010 by webchick, Thu Jan 8 08:42:12 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node.module,v 1.1008 2008/12/31 12:02:22 dries Exp $  // $Id: node.module,v 1.1009 2009/01/04 19:56:51 dries Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1476  function node_ranking() { Line 1476  function node_ranking() {
1476  }  }
1477    
1478  /**  /**
1479   * Implementation of hook_user_delete().   * Implementation of hook_user_cancel().
1480   */   */
1481  function node_user_delete(&$edit, &$user) {  function node_user_cancel(&$edit, &$account, $method) {
1482    db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);    switch ($method) {
1483    db_query('UPDATE {node_revision} SET uid = 0 WHERE uid = %d', $user->uid);      case 'user_cancel_block_unpublish':
1484          // Unpublish nodes (current revisions).
1485          module_load_include('inc', 'node', 'node.admin');
1486          $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
1487          node_mass_update($nodes, array('status' => 0));
1488          break;
1489    
1490        case 'user_cancel_reassign':
1491          // Anonymize nodes (current revisions).
1492          module_load_include('inc', 'node', 'node.admin');
1493          $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
1494          node_mass_update($nodes, array('uid' => 0));
1495          // Anonymize old revisions.
1496          db_update('node_revision')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute();
1497          // Clean history.
1498          db_delete('history')->condition('uid', $account->uid)->execute();
1499          break;
1500    
1501        case 'user_cancel_delete':
1502          // Delete nodes (current revisions).
1503          // @todo Introduce node_mass_delete() or make node_mass_update() more flexible.
1504          $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
1505          foreach ($nodes as $nid) {
1506            node_delete($nid);
1507          }
1508          // Delete old revisions.
1509          db_delete('node_revision')->condition('uid', $account->uid)->execute();
1510          // Clean history.
1511          db_delete('history')->condition('uid', $account->uid)->execute();
1512          break;
1513      }
1514  }  }
1515    
1516  /**  /**

Legend:
Removed from v.1.1009  
changed lines
  Added in v.1.1010

  ViewVC Help
Powered by ViewVC 1.1.3