You are here

function entityform_user_previous_submission in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.module \entityform_user_previous_submission()

Get previous submission for a form for a user

Parameters

string $type:

int $uid:

int $draft:

Return value

NULL|Ambigous <A, mixed>

2 calls to entityform_user_previous_submission()
entityform_form_wrapper in ./entityform.admin.inc
Form callback wrapper: create or edit a entityform.
entityform_user_draft in ./entityform.module
Get the current draft submission if any for a user

File

./entityform.module, line 466
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function entityform_user_previous_submission($type, $uid = NULL, $draft = 0) {
  if (!$uid) {
    global $user;
    $uid = $user->uid;
  }
  if ($uid) {
    $submissions = entityform_get_submissions($type, $uid, $draft);
    $submission = array_shift($submissions);
    if (!$submission) {
      return NULL;
    }
    else {
      return entityform_load($submission->entityform_id);
    }
  }
  return NULL;
}