| @@ -123,38 +123,27 @@ | ||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Define actions to register the setup screen. |
| 126 | 126 | add_action( 'admin_menu', array( $this, 'register_screen' ) ); |
| 127 | - add_action( 'admin_head', array( $this, 'hide_screen_from_menu' ) ); | |
| 128 | 127 | add_action( 'admin_init', array( $this, 'maybe_load_setup_screen' ) ); |
| 129 | 128 | |
| 130 | 129 | } |
| 131 | 130 | |
| 132 | 131 | /** |
| 133 | - * Register the setup screen in WordPress' Dashboard, so that index.php?page={$this->page_name} | |
| 132 | + * Register the wizard screen in WordPress' Dashboard, so that options.php?page={$this->page_name} | |
| 134 | 133 | * does not 404 when in the WordPress Admin interface. |
| 135 | 134 | * |
| 135 | + * Ensures the WordPress user has the given required_capability to access this screen. | |
| 136 | + * | |
| 136 | 137 | * @since 1.9.8.4 |
| 137 | 138 | */ |
| 138 | 139 | public function register_screen() { |
| 139 | 140 | |
| 140 | - add_dashboard_page( '', '', 'edit_posts', $this->page_name, '__return_false' ); | |
| 141 | + add_submenu_page( '', '', '', $this->required_capability, $this->page_name, '__return_false' ); | |
| 141 | 142 | |
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | /** |
| 145 | - * Hides the menu registered when register_screen() above is called, otherwise | |
| 146 | - * we would have a blank submenu entry below the Dashboard menu. | |
| 147 | - * | |
| 148 | - * @since 1.9.8.4 | |
| 149 | - */ | |
| 150 | - public function hide_screen_from_menu() { | |
| 151 | - | |
| 152 | - remove_submenu_page( 'index.php', $this->page_name ); | |
| 153 | - | |
| 154 | - } | |
| 155 | - | |
| 156 | - /** | |
| 157 | 146 | * Loads the setup screen if the request URL is for this class |
| 158 | 147 | * |
| 159 | 148 | * @since 1.9.8.4 |
| 160 | 149 | */ |
| @@ -246,9 +235,9 @@ | ||
| 246 | 235 | 'page' => $this->page_name, |
| 247 | 236 | 'convertkit-modal' => $this->is_modal(), |
| 248 | 237 | 'step' => $this->step, |
| 249 | 238 | ), |
| 250 | - admin_url( 'index.php' ) | |
| 239 | + admin_url( 'options.php' ) | |
| 251 | 240 | ); |
| 252 | 241 | |
| 253 | 242 | // Define the previous step URL if we're not on the first or last step. |
| 254 | 243 | if ( $this->step > 1 && $this->step < count( $this->steps ) ) { |
| @@ -257,9 +246,9 @@ | ||
| 257 | 246 | 'page' => $this->page_name, |
| 258 | 247 | 'convertkit-modal' => $this->is_modal(), |
| 259 | 248 | 'step' => ( $this->step - 1 ), |
| 260 | 249 | ), |
| 261 | - admin_url( 'index.php' ) | |
| 250 | + admin_url( 'options.php' ) | |
| 262 | 251 | ); |
| 263 | 252 | } |
| 264 | 253 | |
| 265 | 254 | // Define the next step URL if we're not on the last page. |
| @@ -269,9 +258,9 @@ | ||
| 269 | 258 | 'page' => $this->page_name, |
| 270 | 259 | 'convertkit-modal' => $this->is_modal(), |
| 271 | 260 | 'step' => ( $this->step + 1 ), |
| 272 | 261 | ), |
| 273 | - admin_url( 'index.php' ) | |
| 262 | + admin_url( 'options.php' ) | |
| 274 | 263 | ); |
| 275 | 264 | } |
| 276 | 265 | |
| 277 | 266 | } |