feat: remove forum feature (Phase 1)

This commit is contained in:
2026-08-02 20:02:44 +08:00
parent f3e4cdd9cf
commit 2bbd7c01a3
173 changed files with 51 additions and 27360 deletions
-58
View File
@@ -21,17 +21,6 @@ if (!function_exists('aksrt_get_header_newposts_config')) :
$types = is_array($cfg['types'] ?? null) ? $cfg['types'] : [];
if (!$types) {
$types = ['post'];
if (class_exists('\AKSRT\Settings\Settings')) {
$forum = \AKSRT\Settings\Settings::get_forum_settings();
$shop = \AKSRT\Settings\Settings::get_shop_settings();
if (!empty($forum['enabled'])) {
$types[] = 'topic';
$types[] = 'plate';
}
if (!empty($shop['enabled'])) {
$types[] = 'product';
}
}
}
$cfg['types'] = $types;
if (empty($cfg['class'])) {
@@ -65,53 +54,6 @@ if (!function_exists('aksrt_get_new_add_actions')) :
'label' => __('写文章', 'aksrt'),
'icon' => 'fas fa-file-alt',
];
} elseif ($type === 'topic') {
$url = function_exists('aksrt_get_forum_compose_url') ? aksrt_get_forum_compose_url() : '';
if ($url === '') {
continue;
}
$out[] = [
'type' => 'topic',
'url' => $url,
'label' => __('发帖', 'aksrt'),
'icon' => 'fas fa-comments',
];
} elseif ($type === 'product') {
$url = '';
if (function_exists('aksrt_get_product_edit_url')) {
$url = (string) aksrt_get_product_edit_url();
}
if ($url === '') {
$url = admin_url('post-new.php?post_type=aksrt_product');
}
$out[] = [
'type' => 'product',
'url' => $url,
'label' => __('发布商品', 'aksrt'),
'icon' => 'fas fa-shopping-bag',
];
} elseif ($type === 'plate') {
// zibll bbs_plate → AKSRT forum plate CPT (admin create for entitled users).
$can = current_user_can('manage_options');
if (!$can && class_exists('\AKSRT\Forum\Forum')) {
try {
$forum = \AKSRT\Forum\Forum::get_instance();
if (method_exists($forum, 'forum_user_can')) {
$can = (bool) $forum->forum_user_can(get_current_user_id(), 'plate_create');
}
} catch (\Throwable $e) {
$can = false;
}
}
if (!$can || !post_type_exists('aksrt_forum_plate')) {
continue;
}
$out[] = [
'type' => 'plate',
'url' => admin_url('post-new.php?post_type=aksrt_forum_plate'),
'label' => __('创建版块', 'aksrt'),
'icon' => 'fas fa-th-large',
];
}
}
return $out;