Projet

Général

Profil

Révision 7547bb19

Ajouté par Assos Assos il y a environ 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views_bulk_operations/actions/user_cancel.action.inc
1 1
<?php
2 2
/**
3
  * @file
4
  * VBO action to cancel user accounts.
5
  */
3
 * @file
4
 * VBO action to cancel user accounts.
5
 */
6 6

  
7 7
function views_bulk_operations_user_cancel_action_info() {
8
  return array('views_bulk_operations_user_cancel_action' => array(
9
    'type' => 'user',
10
    'label' => t('Cancel user account'),
11
    'configurable' => TRUE,
12
    'behavior' => array('deletes_property'),
13
    'triggers' => array('any'),
14
  ));
8
  return array(
9
    'views_bulk_operations_user_cancel_action' => array(
10
      'type' => 'user',
11
      'label' => t('Cancel user account'),
12
      'configurable' => TRUE,
13
      'behavior' => array('deletes_property'),
14
      'triggers' => array('any'),
15
    ),
16
  );
15 17
}
16 18

  
17 19
function views_bulk_operations_user_cancel_action_form($context) {
......
75 77
      if (!empty($context['user_cancel_notify'])) {
76 78
        _user_mail_notify('status_canceled', $account);
77 79
      }
78
      user_delete($account->uid);
80
      // In cases when nodes are to be reassigned to UID 0, the user_delete must
81
      // not run until *after* the user_cancel has been invoked, otherwise the
82
      // nodes are deleted before they can be reassigned. Adding the user delete
83
      // to the batch queue ensures things happen in the correct sequence.
84
      $batch = array(
85
        'operations' => array(
86
          array('user_delete', array($account->uid)),
87
        ),
88
        'file' => drupal_get_path('module', 'node') . '/node.admin.inc',
89
      );
90
      batch_set($batch);
79 91
      watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
80 92
      break;
81 93
  }

Formats disponibles : Unified diff