You are here

function autosave_get_autosaved_form in Autosave 5

Same name and namespace in other branches
  1. 5.3 autosave.module \autosave_get_autosaved_form()
  2. 5.2 autosave.module \autosave_get_autosaved_form()
  3. 6.2 autosave.module \autosave_get_autosaved_form()
  4. 6 autosave.module \autosave_get_autosaved_form()
  5. 7.2 autosave.module \autosave_get_autosaved_form()
  6. 7 autosave.module \autosave_get_autosaved_form()

Get the autosaved form at a particular path for a user.

Parameters

string $form_id: The form_id of the form.

string $path : The the internal Drupal path where the form is located

string $uid : Drupal UID of the user

Return value

An array containing the serialized values of the autosaved form and the timestamp of when the form was autosaved.

1 call to autosave_get_autosaved_form()
autosave_form_alter in ./autosave.module
Implementation of hook_form_alter().

File

./autosave.module, line 140
Automatically saves a node after a period of time.

Code

function autosave_get_autosaved_form($form_id, $path, $uid) {
  $result = db_query("SELECT form_id, serialized, timestamp FROM {autosaved_forms} WHERE form_id = '%s' AND path = '%s' AND uid = %d", $form_id, $path, $uid);
  while ($data = db_fetch_object($result)) {
    $form['serialized'] = $data->serialized;
    $form['timestamp'] = $data->timestamp;
  }
  return $form;
}