INSERT IGNORE INTO `engine4_core_menuitems` (`name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `order`) VALUES ('forum_admin_main_managetopic', 'forum', 'Manage Topics', '', '{"route":"admin_default","module":"forum","controller":"manage-topics"}', 'forum_admin_main', '', 10),
('forum_admin_main_managepost', 'forum', 'Manage Topic Posts', '', '{"route":"admin_default","module":"forum","controller":"manage-posts"}', 'forum_admin_main', '', 11);


ALTER TABLE `engine4_forum_topics` ADD `approved` TINYINT(1) NOT NULL DEFAULT "1";
ALTER TABLE `engine4_forum_topics` ADD INDEX(`approved`);

ALTER TABLE `engine4_forum_topics` ADD `resubmit` TINYINT(1) NOT NULL DEFAULT "0";
ALTER TABLE `engine4_forum_topics` ADD INDEX(`resubmit`);

ALTER TABLE `engine4_forum_posts` ADD `approved` TINYINT(1) NOT NULL DEFAULT "1";
ALTER TABLE `engine4_forum_posts` ADD INDEX(`approved`);

ALTER TABLE `engine4_forum_posts` ADD `resubmit` TINYINT(1) NOT NULL DEFAULT "0";
ALTER TABLE `engine4_forum_posts` ADD INDEX(`resubmit`);

INSERT IGNORE INTO `engine4_authorization_permissions`
SELECT
  level_id as `level_id`,
  'forum' as `type`,
  'approve' as `name`,
  1 as `value`,
  NULL as `params`
FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');

INSERT IGNORE INTO `engine4_authorization_permissions`
SELECT
  level_id as `level_id`,
  'forum' as `type`,
  'approve' as `name`,
  1 as `value`,
  NULL as `params`
FROM `engine4_authorization_levels` WHERE `type` IN('user');

INSERT IGNORE INTO `engine4_authorization_permissions`
SELECT
  level_id as `level_id`,
  'forum' as `type`,
  'post.approve' as `name`,
  1 as `value`,
  NULL as `params`
FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');

INSERT IGNORE INTO `engine4_authorization_permissions`
SELECT
  level_id as `level_id`,
  'forum' as `type`,
  'post.approve' as `name`,
  1 as `value`,
  NULL as `params`
FROM `engine4_authorization_levels` WHERE `type` IN('user');
