Changeset 1064 for trunk/common


Ignore:
Timestamp:
11/26/09 22:50:21 (2 years ago)
Author:
savin.tiberiu@…
Message:

Added the number of unread personal messages to the "mesaje" tab in the navigation bar.

Solved ticket #248.

Review URL: http://reviewboard.infoarena.ro/r/78/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/db/smf.php

    r1058 r1064  
    220220} 
    221221 
     222// Counts the number of unread personal messages 
     223function smf_get_pm_count($username) { 
     224   $from_cache = mem_cache_get("smf-new-pm-".$username); 
     225 
     226    if ($from_cache !== false) { 
     227        return $from_cache; 
     228    } 
     229 
     230    $user_smf_id = smf_get_member_id($username); 
     231    $prefix = IA_SMF_DB_PREFIX; 
     232    $query = " 
     233        SELECT COUNT(*) FROM {$prefix}pm_recipients 
     234        WHERE ID_MEMBER = ".$user_smf_id." AND is_read = 0 
     235    "; 
     236 
     237    // Cache value 
     238    $new_pm_count = db_query_value($query); 
     239    mem_cache_set("smf-new-pm-".$username, $new_pm_count, 600); 
     240    return $new_pm_count; 
     241} 
    222242?> 
Note: See TracChangeset for help on using the changeset viewer.