Please Log in to join the conversation.
public function getPMSunreadCount( $userId )
{
global $_CB_database;
if ( UddeIM::isUddeIM() ) {
return UddeIM::getPMSunreadCount( $userId );
}
static $cache = array();
if ( ! isset( $cache[$userId] ) ) {
$query = "SELECT COUNT(*)"
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_messages' ) . " AS m"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler_plugin_messages_read' ) . " AS r"
. " ON r." . $_CB_database->NameQuote( 'to_user' ) . " = " . (int) $userId
. " AND r." . $_CB_database->NameQuote( 'message' ) . " = m." . $_CB_database->NameQuote( 'id' )
. "\n WHERE ( ( m." . $_CB_database->NameQuote( 'from_user' ) . " != " . (int) $userId
. " AND m." . $_CB_database->NameQuote( 'to_user' ) . " = 0 )"
. " OR ( m." . $_CB_database->NameQuote( 'to_user' ) . " = " . (int) $userId
. " AND m." . $_CB_database->NameQuote( 'to_user_delete' ) . " = 0 ) )"
. "\n AND r." . $_CB_database->NameQuote( 'id' ) . " IS NULL";
$_CB_database->setQuery( $query );
$cache[$userId] = (int) $_CB_database->loadResult();
}
return $cache[$userId];
}
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.