Skip to content

Commit 5b836ba

Browse files
committed
fix for admin page
1 parent 1b6a682 commit 5b836ba

4 files changed

Lines changed: 7 additions & 18 deletions

File tree

activate.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
* @since 1.0.0
1313
*/
1414
function sqlite_plugin_activation_redirect() {
15-
wp_safe_redirect( admin_url( 'admin.php?page=sqlite-integration' ) );
15+
wp_redirect( admin_url( 'options-general.php?page=sqlite-integration' ) );
16+
exit;
1617
}
17-
register_activation_hook( __FILE__, 'sqlite_plugin_activation_redirect' );
18+
// register_activation_hook( SQLITE_MAIN_FILE, 'sqlite_plugin_activation_redirect' );
1819

1920
/**
2021
* Check the URL to ensure we're on the plugin page,
@@ -27,7 +28,7 @@ function sqlite_plugin_activation_redirect() {
2728
*/
2829
function sqlite_activation() {
2930
global $current_screen;
30-
if ( isset( $current_screen->base ) && 'toplevel_page_sqlite-integration' === $current_screen->base ) {
31+
if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) {
3132
return;
3233
}
3334
if ( isset( $_GET['confirm-install'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'sqlite-install' ) ) {

admin-notices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function sqlite_plugin_admin_notice() {
1515

1616
// Don't print notices in the plugin's admin screen.
1717
global $current_screen;
18-
if ( isset( $current_screen->base ) && 'toplevel_page_sqlite-integration' === $current_screen->base ) {
18+
if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) {
1919
return;
2020
}
2121

admin-page.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,17 @@
1313
* @since 1.0.0
1414
*/
1515
function sqlite_add_dummy_admin_menu() {
16-
add_menu_page(
16+
add_options_page(
1717
__( 'SQLite integration', 'sqlite' ),
1818
__( 'SQLite integration', 'sqlite' ),
1919
'manage_options',
2020
'sqlite-integration',
2121
'sqlite_integration_pre_install_check_screen',
22-
'',
23-
3
2422
);
2523

2624
}
2725
add_action( 'admin_menu', 'sqlite_add_dummy_admin_menu' );
2826

29-
/**
30-
* Remove the admin menu, leaving the page itself.
31-
*
32-
* @since 1.0.0
33-
*/
34-
function sqlite_remove_dummy_admin_menu() {
35-
remove_menu_page( 'sqlite-integration' );
36-
}
37-
add_action( 'admin_init', 'sqlite_remove_dummy_admin_menu' );
38-
3927
/**
4028
* The admin page contents.
4129
*/

sqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
define( 'SQLITE_MAIN_FILE', __FILE__ );
1515

16+
require_once __DIR__ . '/admin-page.php';
1617
require_once __DIR__ . '/activate.php';
1718
require_once __DIR__ . '/deactivate.php';
18-
require_once __DIR__ . '/admin-page.php';
1919
require_once __DIR__ . '/admin-notices.php';
2020
require_once __DIR__ . '/health-check.php';

0 commit comments

Comments
 (0)