feat(user-center): deepen zibll parity and profile media

This commit is contained in:
kate522 committed 2026-07-28 12:22:52 +08:00
1 parent c13f686cdc
commit e47ee1b029
16 files changed
+479 -65

No files matched your search

+32 -9
View File
@@ -125,6 +125,32 @@ $_aksrt_special_templates = [
'title' => '收益中心',
'fallback' => '/revenue/',
],
'messages' => [
'file' => 'templates/pages/page-messages.php',
'slug' => 'messages',
'title' => '消息中心',
'fallback' => '/messages/',
],
'submit' => [
'file' => 'templates/pages/page-submit.php',
'slug' => 'submit',
'title' => '发布文章',
'fallback' => '/submit/',
],
'product-edit' => [
'file' => 'templates/pages/page-product-edit.php',
'slug' => 'product-edit',
'title' => '发布商品',
'fallback' => '/product-edit/',
'auto_create' => false,
],
'forum-compose' => [
'file' => 'templates/forum/forum-compose.php',
'slug' => 'forum-compose',
'title' => '论坛发帖',
'fallback' => '/forum-compose/',
'auto_create' => false,
],
];
/** @var array 缓存 key=模板文件路径 => value=WP_Post|null */
@@ -486,6 +512,9 @@ function aksrt_ensure_template_page(string $key): void {
if (!isset($_aksrt_special_templates[$key])) return;
$cfg = $_aksrt_special_templates[$key];
if (array_key_exists('auto_create', $cfg) && empty($cfg['auto_create'])) {
return;
}
$desired_slug = sanitize_title($cfg['slug'] ?? $key);
// 已有页面使用此模板?仍校验模板 meta,避免空白默认页。
@@ -502,15 +531,8 @@ function aksrt_ensure_template_page(string $key): void {
if ($desired_slug !== '') {
$existing_page = get_page_by_path($desired_slug, OBJECT, 'page');
if ($existing_page instanceof WP_Post) {
if ($existing_page->post_status !== 'publish') {
wp_update_post([
'ID' => $existing_page->ID,
'post_status' => 'publish',
]);
}
update_post_meta($existing_page->ID, '_wp_page_template', $cfg['file']);
aksrt_clear_template_page_cache();
// Slug collisions belong to the administrator. System pages are
// created only when the slug is completely free.
return;
}
}
@@ -528,6 +550,7 @@ function aksrt_ensure_template_page(string $key): void {
if (!is_wp_error($page_id) && $page_id > 0) {
update_post_meta($page_id, '_wp_page_template', $cfg['file']);
update_post_meta($page_id, '_aksrt_managed_template_page', (string) $key);
aksrt_clear_template_page_cache();
}
}