$sql = 'SELECT tl.thread_id,tl.thread_title,tl.thread_title_qualify FROM '.$tbl_grade_links.' tl ,'.$tbl_item_property.' ip where tl.thread_id=ip.ref and ip.tool="forum_thread" and ip.visibility<>2 group by ip.ref';
$sql = 'SELECT tl.thread_id,tl.thread_title,tl.thread_title_qualify FROM '.$tbl_grade_links.' tl ,'.$tbl_item_property.' ip WHERE tl.thread_id=ip.ref AND ip.tool="forum_thread" AND ip.visibility<>2 AND tl.session_id='.api_get_session_id().' GROUP BY ip.ref ';
$sql = 'SELECT thread_qualify_max FROM '.Database :: get_course_table(TABLE_FORUM_THREAD, $database_name)." WHERE thread_id = '".$this->get_ref_id()."'";
$sql = 'SELECT thread_qualify_max FROM '.Database :: get_course_table(TABLE_FORUM_THREAD, $database_name)." WHERE thread_id = '".$this->get_ref_id()."' AND session_id=".api_get_session_id()."";
$query = Database::query($sql,__FILE__,__LINE__);
$assignment = Database::fetch_array($query);
@ -239,7 +239,7 @@ class ForumThreadLink extends AbstractLink
*/
public function is_valid_link() {
$sql = 'SELECT count(id) from '.$this->get_forum_thread_table()
.' WHERE thread_id = '.$this->get_ref_id();
.' WHERE thread_id = '.$this->get_ref_id().' AND session_id='.api_get_session_id().'';