function _simplenews_statistics_open_add in Simplenews Statistics 6.3
Add open to total.
1 call to _simplenews_statistics_open_add()
- simplenews_statistics_view in ./
simplenews_statistics.module - Gathers the opens.
File
- ./
simplenews_statistics.module, line 311 - Main simplenews statistics file.
Code
function _simplenews_statistics_open_add($stat) {
// Check if this is a unique open for the newsletter-mail combination.
$query = 'SELECT nid FROM {simplenews_statistics_opens} WHERE email=\'%s\' AND nid=%d LIMIT 1';
$result = db_query($query, $stat['mail'], $stat['nid']);
$row = db_fetch_array($result);
if (empty($row)) {
db_query('UPDATE {simplenews_statistics} SET unique_opens=unique_opens+1 WHERE nid=%d', $stat['nid']);
}
// Update the total opens amount.
db_query('UPDATE {simplenews_statistics} SET total_opens=total_opens+1 WHERE nid=%d', $stat['nid']);
// Register the individual open.
db_query('INSERT INTO {simplenews_statistics_opens} (email, nid, timestamp) VALUES (\'%s\', %d, %d)', $stat['mail'], $stat['nid'], time());
}