diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index 88cdfdfc1..2289f21e9 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -928,6 +928,7 @@ CREATE TABLE IF NOT EXISTS `bb_posts` `post_edit_time` INT(11) NOT NULL DEFAULT '0', `post_edit_count` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0', `post_attachment` TINYINT(1) NOT NULL DEFAULT '0', + `post_pinned` TINYINT(1) NOT NULL DEFAULT '0', `user_post` TINYINT(1) NOT NULL DEFAULT '1', `mc_comment` TEXT NOT NULL DEFAULT '', `mc_type` TINYINT(1) NOT NULL DEFAULT '0', @@ -945,7 +946,7 @@ CREATE TABLE IF NOT EXISTS `bb_posts` -- Records of bb_posts -- ---------------------------- INSERT INTO `bb_posts` -VALUES ('1', '1', '1', '2', UNIX_TIMESTAMP(), '0', '0', '0', '', '0', '0', '0', '1', '', '0', '0'); +VALUES ('1', '1', '1', '2', UNIX_TIMESTAMP(), '0', '0', '0', '', '0', '0', '0', '0', '1', '', '0', '0'); -- ---------------------------- -- Table structure for `bb_posts_html` diff --git a/library/ajax/posts.php b/library/ajax/posts.php index 54ba9da87..0af51fd15 100644 --- a/library/ajax/posts.php +++ b/library/ajax/posts.php @@ -65,9 +65,11 @@ switch ($this->request['type']) { } break; + case 'unpin': case 'pin': if ($post['post_id'] != $post['topic_first_post_id'] && (($userdata['user_id'] == $post['poster_id']) || $is_auth['auth_mod'])) { - + $action = $this->request['type'] == 'unpin' ? 0 : 1; + DB()->query("UPDATE " . BB_POSTS . " SET post_pinned = $action WHERE post_id = $post_id LIMIT 1"); } else { // TODO }