added feature: stick/unstick topic
This commit is contained in:
@@ -45,7 +45,7 @@ class ForumsModel extends Model
|
||||
|
||||
public function getTopics($forum_id)
|
||||
{
|
||||
$out = $this->select(TOPICS_VIEW, '*', 'forum_id=\''.$forum_id.'\'', 'lastpost_post_id DESC');
|
||||
$out = $this->select(TOPICS_VIEW, '*', 'forum_id=\''.$forum_id.'\'', 'sticky DESC,lastpost_post_id DESC');
|
||||
if (count($out) > 0)
|
||||
return $out;
|
||||
else
|
||||
|
||||
@@ -18,7 +18,7 @@ class PostsModel extends Model
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
t.topic_id as topic_id, t.title as topic_title, t.locked as topic_locked, t.forum_id as forum_id, f.name as forum_name, f.locked as forum_locked, pc.post_count as post_count
|
||||
t.topic_id as topic_id, t.title as topic_title, t.sticky as topic_sticky, t.locked as topic_locked, t.forum_id as forum_id, f.name as forum_name, f.locked as forum_locked, pc.post_count as post_count
|
||||
FROM '.TOPICS_TABLE.' t
|
||||
LEFT JOIN '.FORUMS_TABLE.' f ON f.forum_id = t.forum_id
|
||||
LEFT JOIN '.TOPICS_PC_VIEW.' pc ON pc.topic_id = t.topic_id
|
||||
@@ -82,6 +82,13 @@ class PostsModel extends Model
|
||||
$this->db->query($query);
|
||||
}
|
||||
|
||||
public function stickTopic($topic_id, $sticky = true)
|
||||
{
|
||||
$query = 'UPDATE '.TOPICS_TABLE.' SET sticky=\''.$sticky.'\' WHERE topic_id=\''.$topic_id.'\';';
|
||||
|
||||
$this->db->query($query);
|
||||
}
|
||||
|
||||
public function moveTopic($topic_id, $forum_id)
|
||||
{
|
||||
$query = 'UPDATE '.TOPICS_TABLE.' SET forum_id=\''.$forum_id.'\' WHERE topic_id=\''.$topic_id.'\';';
|
||||
|
||||
Reference in New Issue
Block a user