You are here

function gdpr_tasks_get_user_tasks in General Data Protection Regulation 7

Get a list of tasks for a user.

Optional condition on the type of task if provided.

1 call to gdpr_tasks_get_user_tasks()
gdpr_tasks_request in modules/gdpr_tasks/gdpr_tasks.pages.inc
Request page for user.

File

modules/gdpr_tasks/gdpr_tasks.module, line 394
Module file for the GDPR Tasks module.

Code

function gdpr_tasks_get_user_tasks($user, $gdpr_task_type = NULL) {
  $query = db_select('gdpr_task', 't')
    ->fields('t', array(
    'id',
  ))
    ->condition('user_id', $user->uid);
  if ($gdpr_task_type) {
    $query
      ->condition('type', $gdpr_task_type);
  }
  $result = $query
    ->execute()
    ->fetchAssoc();
  if (!empty($result)) {
    return gdpr_task_load_multiple($result);
  }
  return $result;
}