Add real replacement pages for Pages, Media Library, and Users (v2.6.0)
Completes the "skinned vs. replaced" conversion started with Posts — every native list-table screen the user asked about now has a genuine custom Vue page behind it instead of dark-themed CSS over the native markup. All three follow the same pattern as Posts: own REST controller in admin/src/Rest/, own Vue page matching the Comments layout, native screen redirected away (direct visits too, not just the sidebar link), gated by its own Settings toggle defaulting to on. - Pages (PagesData.php + Pages.vue): same as Posts, parent page shown instead of categories. edit.php?post_type=page redirects; other post types untouched. - Media Library (MediaData.php + Media.vue): thumbnail grid with type filters (Images/Audio/Video/Documents/Unattached). Replaces the browse/library experience only — media-new.php (the actual upload screen) is untouched, same reasoning as leaving the block editor alone for Posts/Pages. - Users (UsersData.php + Users.vue): filterable by role. Deleting a user always reassigns their content to whoever performs the deletion rather than exposing WP core's reassign-or-delete-everything choice as a one-click action — deliberately simplified to avoid a surprising, highly destructive default. user-new.php untouched. Verified live: Media's grid renders real thumbnails/dimensions/file sizes with working filters and search; Users shows real accounts with role filters and correctly hides delete for the current user; both redirect correctly from their native URLs. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
56b6674527
commit
204c4365e2
@@ -47,6 +47,9 @@ class SubApps
|
||||
"aurora-admin-plugins" => ["title" => "Installed Plugins", "entry" => "plugins", "feature" => null],
|
||||
"aurora-admin-comments" => ["title" => "Comments", "entry" => "comments", "feature" => null],
|
||||
"aurora-admin-posts" => ["title" => "Posts", "entry" => "posts", "feature" => null],
|
||||
"aurora-admin-pages" => ["title" => "Pages", "entry" => "pages", "feature" => null],
|
||||
"aurora-admin-media" => ["title" => "Media Library", "entry" => "media", "feature" => null],
|
||||
"aurora-admin-users" => ["title" => "Users", "entry" => "users", "feature" => null],
|
||||
];
|
||||
|
||||
private static $hook_suffixes = [];
|
||||
@@ -82,6 +85,15 @@ class SubApps
|
||||
if ($slug === "aurora-admin-posts") {
|
||||
return "edit.php";
|
||||
}
|
||||
if ($slug === "aurora-admin-pages") {
|
||||
return "edit.php?post_type=page";
|
||||
}
|
||||
if ($slug === "aurora-admin-media") {
|
||||
return "upload.php";
|
||||
}
|
||||
if ($slug === "aurora-admin-users") {
|
||||
return "users.php";
|
||||
}
|
||||
return "aurora-admin";
|
||||
}
|
||||
|
||||
@@ -93,6 +105,15 @@ class SubApps
|
||||
if ($slug === "aurora-admin-comments" || $slug === "aurora-admin-posts") {
|
||||
return "edit_posts";
|
||||
}
|
||||
if ($slug === "aurora-admin-pages") {
|
||||
return "edit_pages";
|
||||
}
|
||||
if ($slug === "aurora-admin-media") {
|
||||
return "upload_files";
|
||||
}
|
||||
if ($slug === "aurora-admin-users") {
|
||||
return "list_users";
|
||||
}
|
||||
return "manage_options";
|
||||
}
|
||||
|
||||
@@ -146,6 +167,41 @@ class SubApps
|
||||
wp_safe_redirect(admin_url("admin.php?page=aurora-admin-posts"));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Settings > Pages > "Modern pages table".
|
||||
if (
|
||||
$pagenow === "edit.php" &&
|
||||
$post_type === "page" &&
|
||||
current_user_can("edit_pages") &&
|
||||
Settings::get("modern_pages", true)
|
||||
) {
|
||||
wp_safe_redirect(admin_url("admin.php?page=aurora-admin-pages"));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Settings > Media > "Modern media library". upload.php serves both
|
||||
// the default grid view and ?mode=list — both redirect the same way.
|
||||
// media-new.php (the upload/drag-drop screen) is a separate file,
|
||||
// untouched, same as post-new.php for Posts/Pages.
|
||||
if (
|
||||
$pagenow === "upload.php" &&
|
||||
current_user_can("upload_files") &&
|
||||
Settings::get("modern_media", true)
|
||||
) {
|
||||
wp_safe_redirect(admin_url("admin.php?page=aurora-admin-media"));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Settings > Users > "Modern users table". user-new.php (account
|
||||
// creation) is a separate file, untouched.
|
||||
if (
|
||||
$pagenow === "users.php" &&
|
||||
current_user_can("list_users") &&
|
||||
Settings::get("modern_users", true)
|
||||
) {
|
||||
wp_safe_redirect(admin_url("admin.php?page=aurora-admin-users"));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public static function render()
|
||||
@@ -178,6 +234,9 @@ class SubApps
|
||||
"roles" => $roles,
|
||||
"tablePrefix" => $wpdb->prefix,
|
||||
"newPostUrl" => esc_url_raw(admin_url("post-new.php")),
|
||||
"newPageUrl" => esc_url_raw(admin_url("post-new.php?post_type=page")),
|
||||
"newMediaUrl" => esc_url_raw(admin_url("media-new.php")),
|
||||
"newUserUrl" => esc_url_raw(admin_url("user-new.php")),
|
||||
];
|
||||
$root_id = "aurora-admin-" . self::PAGES[$page]["entry"] . "-root";
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user