<?php
/**
* @author mircobabini
*/
function thread_mark_as_read_for_user( $thread_id, $user_id ) {
global $wpdb, $bp;
$sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $user_id, $thread_id );
$wpdb->query($sql);
wp_cache_delete( $user_id, 'bp_messages_unread_count' );
}