You are here

function _inactive_user_with_content in Inactive User 7

Same name and namespace in other branches
  1. 5 inactive_user.module \_inactive_user_with_content()
  2. 6 inactive_user.module \_inactive_user_with_content()

Returns 1 if the user has ever created a node or a comment.

The settings of inactive_user.module allow to protect such users from deletion.

1 call to _inactive_user_with_content()
inactive_user_cron in ./inactive_user.module
Implements hook_cron().

File

./inactive_user.module, line 763
The inactive user module controls inactive users.

Code

function _inactive_user_with_content($uid) {
  $user_has_nodes = db_select('node', 'n')
    ->fields('n', array(
    'uid',
  ))
    ->condition('n.uid', $uid)
    ->execute()
    ->rowcount();
  $user_has_comments = db_select('comment', 'c')
    ->fields('c', array(
    'uid',
  ))
    ->condition('c.uid', $uid)
    ->execute()
    ->rowcount();
  return $user_has_nodes + $user_has_comments > 0 ? 1 : 0;
}