feat: remove forum feature (Phase 1)
This commit is contained in:
1 parent
f3e4cdd9cf
commit
2bbd7c01a3
173 files changed
+51
-27360
No files matched your search
@@ -130,92 +130,3 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array('product', $enabled_tabs, true)) : ?>
|
||||
<div id="panel-product" class="dashboard-panel<?php echo $active_tab === 'product' ? ' is-active' : ''; ?>" role="tabpanel"<?php echo $active_tab !== 'product' ? ' hidden' : ''; ?>>
|
||||
<?php
|
||||
$product_page = max(1, isset($_GET['product_page']) ? (int) $_GET['product_page'] : 1);
|
||||
$product_view = ['items' => [], 'total' => 0, 'max_pages' => 0];
|
||||
if (class_exists('\AKSRT\Shop\Shop')) {
|
||||
$product_view = \AKSRT\Shop\Shop::get_instance()->get_store_products((int) $user_id, $product_page, (int) $per_page);
|
||||
}
|
||||
$product_items = is_array($product_view['items'] ?? null) ? $product_view['items'] : [];
|
||||
$product_max_pages = (int) ($product_view['max_pages'] ?? 0);
|
||||
if (!empty($product_items)) :
|
||||
?>
|
||||
<div class="aksrt-product-archive__grid aksrt-product-archive__grid--default uh-product-grid">
|
||||
<?php foreach ($product_items as $product) :
|
||||
get_template_part('templates/parts/shop/product', 'card', [
|
||||
'product' => $product,
|
||||
'show_sales' => ((int) ($product['sales'] ?? 0) > 0),
|
||||
]);
|
||||
endforeach; ?>
|
||||
</div>
|
||||
<?php if ($product_max_pages > 1 && function_exists('aksrt_render_profile_pagination')) : ?>
|
||||
<?php aksrt_render_profile_pagination($product_max_pages, $product_page, 'product_page'); ?>
|
||||
<?php elseif ($product_max_pages > 1) : ?>
|
||||
<?php
|
||||
echo paginate_links([
|
||||
'base' => add_query_arg(['tab' => 'product', 'product_page' => '%#%'], $home_url),
|
||||
'format' => '',
|
||||
'current' => $product_page,
|
||||
'total' => $product_max_pages,
|
||||
'add_args' => ['tab' => 'product'],
|
||||
]);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php aksrt_render_profile_empty($svg_empty_post, __('暂无商品内容', 'aksrt')); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array('plate', $enabled_tabs, true)) : ?>
|
||||
<div id="panel-plate" class="dashboard-panel<?php echo $active_tab === 'plate' ? ' is-active' : ''; ?>" role="tabpanel"<?php echo $active_tab !== 'plate' ? ' hidden' : ''; ?>>
|
||||
<?php
|
||||
$plate_items = [];
|
||||
if ($forum_instance) {
|
||||
if (method_exists($forum_instance, 'get_user_followed_plates')) {
|
||||
$plate_items = array_merge($plate_items, (array) $forum_instance->get_user_followed_plates((int) $user_id));
|
||||
}
|
||||
if (method_exists($forum_instance, 'get_user_managed_plates')) {
|
||||
$managed = (array) $forum_instance->get_user_managed_plates((int) $user_id);
|
||||
foreach (['owned', 'moderating'] as $bucket) {
|
||||
foreach ((array) ($managed[$bucket] ?? []) as $plate) {
|
||||
$plate_items[] = $plate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// de-dupe by id
|
||||
$seen = [];
|
||||
$unique_plates = [];
|
||||
foreach ($plate_items as $plate) {
|
||||
$pid = (int) ($plate['id'] ?? 0);
|
||||
if ($pid <= 0 || isset($seen[$pid])) {
|
||||
continue;
|
||||
}
|
||||
$seen[$pid] = true;
|
||||
$unique_plates[] = $plate;
|
||||
}
|
||||
if (!empty($unique_plates)) :
|
||||
?>
|
||||
<div class="uh-forum__plate-grid">
|
||||
<?php foreach ($unique_plates as $plate) :
|
||||
$purl = !empty($plate['url']) ? (string) $plate['url'] : get_permalink((int) ($plate['id'] ?? 0));
|
||||
?>
|
||||
<a class="uh-forum__plate-card" href="<?php echo esc_url((string) $purl); ?>">
|
||||
<div class="uh-forum__plate-name"><?php echo esc_html((string) ($plate['name'] ?? '')); ?></div>
|
||||
<div class="uh-forum__plate-stats">
|
||||
<span><?php printf(esc_html__('%d 帖子', 'aksrt'), (int) ($plate['topic_count'] ?? $plate['post_count'] ?? 0)); ?></span>
|
||||
<span><?php printf(esc_html__('%d 关注', 'aksrt'), (int) ($plate['follow_count'] ?? 0)); ?></span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else :
|
||||
aksrt_render_profile_empty($svg_empty_post, __('暂无圈子内容', 'aksrt'));
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
Reference in new issue
Block a user