PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.15
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.15
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / admin / class-admin-welcome.php

class-admin-welcome.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.15, at includes/admin/class-admin-welcome.php

64 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The welcome class after install
5 *
6 * @since 1.1.0
7 */
8 class WeForms_Admin_Welcome {
9
10 public function __construct() {
11 add_action( 'admin_menu', [ $this, 'register_menu' ] );
12 add_action( 'admin_head', [ $this, 'hide_menu' ] );
13 add_action( 'admin_init', [ $this, 'redirect_to_page' ], 9999 );
14 }
15
16 /**
17 * Register the admin menu to setup the welcome message
18 *
19 * @return void
20 */
21 public function register_menu() {
22 add_dashboard_page( __( 'Welcome to weForms', 'weforms' ), __( 'Welcome to weForms', 'weforms' ), 'manage_options', 'weforms-welcome', [ $this, 'welcome_page' ] );
23 }
24
25 /**
26 * Hide the menu as we don't want to show the welcome page in admin menu
27 *
28 * @return void
29 */
30 public function hide_menu() {
31 remove_submenu_page( 'index.php', 'weforms-welcome' );
32 }
33
34 /**
35 * Redirect to the welcome page once the plugin is installed
36 *
37 * @return void
38 */
39 public function redirect_to_page() {
40 if ( !get_transient( 'weforms_activation_redirect' ) ) {
41 return;
42 }
43
44 delete_transient( 'weforms_activation_redirect' );
45
46 // Only do this for single site installs.
47 if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
48 return;
49 }
50
51 wp_safe_redirect( admin_url( 'index.php?page=weforms-welcome' ) );
52 exit;
53 }
54
55 /**
56 * Render the welcome page
57 *
58 * @return void
59 */
60 public function welcome_page() {
61 echo 'Hello There!';
62 }
63 }
64