You are here

function _privatemsg_limits_get_oldest in Privatemsg 6.2

Same name and namespace in other branches
  1. 7.2 privatemsg_limits/privatemsg_limits.module \_privatemsg_limits_get_oldest()
  2. 7 privatemsg_limits/privatemsg_limits.module \_privatemsg_limits_get_oldest()

Loads the oldest message a user has written in the specified timeframe.

Parameters

$account: User object

$timeframe: Defines how many seconds back should be considered.

1 call to _privatemsg_limits_get_oldest()
privatemsg_limits_privatemsg_message_validate in privatemsg_limits/privatemsg_limits.module
Implements hook_privatemsg_message_validate().

File

privatemsg_limits/privatemsg_limits.module, line 215
Privatemsg Quota module

Code

function _privatemsg_limits_get_oldest($account, $timeframe) {
  $query = _privatemsg_assemble_query(array(
    'sent',
    'privatemsg_limits',
  ), $account, $timeframe);
  $row = db_fetch_array(db_query($query['query']));
  $wait_time = $row['timestamp'] - (time() - $timeframe);
  return format_interval($wait_time, 6);
}