page_slug = 'welcome'; $this->title = __( 'Welcome to Social Snap!', 'socialsnap' ); // Actions add_action( 'admin_menu', array( $this, 'register_pages' ), 12 ); add_action( 'admin_init', array( $this, 'redirect' ), 9999 ); add_action( 'admin_notices', array( $this, 'display_notices' ) ); // Add AJAX handler for subscribe add_action( 'wp_ajax_socialsnap_subscribe', array( $this, 'subscribe' ) ); } /** * Register the pages to be used for the Welcome screen (and tabs). * * These pages will be removed from the Dashboard menu, so they will * not actually show. * * @since 1.0.0 */ public function register_pages() { // Getting started - shows after installation add_submenu_page( 'socialsnap-settings', __( 'Welcome to Social Snap', 'socialsnap' ), __( 'About', 'socialsnap' ), apply_filters( 'socialsnap_welcome_cap', 'manage_options' ), 'about-socialsnap', array( $this, 'render' ) ); } /** * Welcome screen redirect. * * This function checks if a new install or update has just occured. If so, * then we redirect the user to the appropriate page. * * @since 1.0.0 */ public function redirect() { // Check if we should consider redirection. if ( ! get_site_transient( 'socialsnap_activation_redirect' ) ) { return; } // If we are redirecting, clear the transient so it only happens once. delete_site_transient( 'socialsnap_activation_redirect' ); // Check option to disable welcome redirect. if ( get_option( 'socialsnap_activation_redirect', false ) ) { return; } // Only do this for single site installs. if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } // Initial install. wp_safe_redirect( admin_url( 'admin.php?page=about-socialsnap' ) ); exit; } /** * Build the output for the plugin welcome page. * * @since 1.0.0 */ public function render() { ?>
Social Snap — Start driving more traffic and increase engagement by leveraging the power of social media.', 'socialsnap' ); ?>