fix(users): keep management inside center
This commit is contained in:
1 parent
c3bfd12c69
commit
ce2b266890
44 files changed
+194
-2584
No files matched your search
@@ -142,6 +142,8 @@ if (!function_exists('aksrt_capture_user_center_view')) {
|
||||
'level' => 'level',
|
||||
'profile' => 'form',
|
||||
'creator' => 'creator',
|
||||
'posts' => 'posts',
|
||||
'follow' => 'follow',
|
||||
'comments' => 'comments',
|
||||
'favorites' => 'favorites',
|
||||
'credits' => 'credits',
|
||||
@@ -173,7 +175,7 @@ if (!function_exists('aksrt_capture_user_center_panel')) {
|
||||
* Capture a built-in or registered user-center panel body.
|
||||
*/
|
||||
function aksrt_capture_user_center_panel(string $tab_key, array $tab, array $context): string {
|
||||
$built_in_tabs = ['profile', 'level', 'creator', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
|
||||
$built_in_tabs = ['profile', 'level', 'creator', 'posts', 'follow', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
|
||||
if (in_array($tab_key, $built_in_tabs, true)) {
|
||||
return aksrt_capture_user_center_view($tab_key, $context);
|
||||
}
|
||||
@@ -446,6 +448,26 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
$follower_count = class_exists('\AKSRT\User\Follow')
|
||||
? \AKSRT\User\Follow::get_instance()->get_follower_count($user_id)
|
||||
: 0;
|
||||
$following_count = class_exists('\AKSRT\User\Follow')
|
||||
? \AKSRT\User\Follow::get_instance()->get_following_count($user_id)
|
||||
: 0;
|
||||
$allowed_post_statuses = ['publish', 'draft', 'pending', 'private'];
|
||||
$post_status_filter = isset($_GET['post_status']) ? sanitize_key(wp_unslash($_GET['post_status'])) : 'publish';
|
||||
if (!in_array($post_status_filter, array_merge($allowed_post_statuses, ['all']), true)) {
|
||||
$post_status_filter = 'publish';
|
||||
}
|
||||
$user_status_counts = [];
|
||||
foreach ($allowed_post_statuses as $status) {
|
||||
$status_query = new WP_Query([
|
||||
'author' => $user_id,
|
||||
'post_type' => 'post',
|
||||
'post_status' => $status,
|
||||
'posts_per_page' => 1,
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => false,
|
||||
]);
|
||||
$user_status_counts[$status] = (int) $status_query->found_posts;
|
||||
}
|
||||
|
||||
$svgs = aksrt_user_center_empty_svgs();
|
||||
require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
@@ -478,6 +500,7 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
'favorite_post_ids' => $favorite_post_ids,
|
||||
'favorite_count' => $favorite_count,
|
||||
'follower_count' => $follower_count,
|
||||
'following_count' => $following_count,
|
||||
'user_contacts' => $user_contacts,
|
||||
'profile_signals' => $dashboard['profile_signals'] ?? [],
|
||||
'user_background_url' => $user_background_url,
|
||||
@@ -487,13 +510,16 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
'messages_url' => $messages_enabled && function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '',
|
||||
'revenue_url' => $revenue_url,
|
||||
'per_page' => 10,
|
||||
'posts_page' => max(1, isset($_GET['posts_page']) ? (int) $_GET['posts_page'] : 1),
|
||||
'post_status_filter' => $post_status_filter,
|
||||
'user_status_counts' => $user_status_counts,
|
||||
'new_post_url' => function_exists('aksrt_get_new_post_url') ? aksrt_get_new_post_url() : '',
|
||||
'svg_empty_post' => $svgs['post'],
|
||||
'comments_page' => max(1, isset($_GET['comments_page']) ? (int) $_GET['comments_page'] : 1),
|
||||
'favorites_page' => max(1, isset($_GET['favorites_page']) ? (int) $_GET['favorites_page'] : 1),
|
||||
'svg_empty_comment' => $svgs['comment'],
|
||||
'svg_empty_favorite' => $svgs['favorite'],
|
||||
'orders_url' => function_exists('aksrt_get_user_center_tab_url')
|
||||
? aksrt_get_user_center_tab_url('orders')
|
||||
: (function_exists('aksrt_get_orders_page_url') ? aksrt_get_orders_page_url() : ''),
|
||||
'orders_url' => isset($tabs['tabs']['orders']) ? aksrt_get_user_center_tab_url('orders') : '',
|
||||
'show_vip' => !empty($vip_settings['enabled']),
|
||||
'show_credit_tabs' => $show_credit_tabs,
|
||||
'affiliate_enabled' => $show_credit_tabs && !empty($affiliate_settings['enabled']),
|
||||
|
||||
Reference in new issue
Block a user