intersynergy-login-plugin.php
/**
     * Plugin activation hook.
     *
     * Creates all WordPress pages needed by the plugin.
     */
Plugin activation hook.
Creates all WordPress pages needed by the plugin.
Plugin activation hook . Creates all WordPress pages needed by the plugin .
public static function plugin_activated()
    {
        $instance = self::getInstance();
        $page_definitions = array(
            $instance->pageSlug['member-login'] => array(
                'title' => __('Sign In', 'intersynergy-login-plugin'),
                'content' => '[intersynergy-login-form]',
            ),
            $instance->pageSlug['member-account'] => array(
                'title' => __('Your Account', 'intersynergy-login-plugin'),
                'content' => '[account-info]',
            ),
            $instance->pageSlug['member-register'] => array(
                'title' => __('Register', 'intersynergy-login-plugin'),
                'content' => '[intersynergy-register-form]',
            ),
            $instance->pageSlug['member-password-lost'] => array(
                'title' => __('Forgot Your Password?', 'intersynergy-login-plugin'),
                'content' => '[intersynergy-password-lost-form]',
            ),
            $instance->pageSlug['member-password-reset'] => array(
                'title' => __('Pick a New Password', 'intersynergy-login-plugin'),
                'content' => '[intersynergy-password-reset-form]',
            ),
        );
        foreach ($page_definitions as $slug => $page) {
            $query = new WP_Query('pagename='.$slug);
            if (! $query->have_posts()) {
                wp_insert_post(
                    array(
                        'post_content'   => $page['content'],
                        'post_name'      => $slug,
                        'post_title'     => $page['title'],
                        'post_status'    => 'publish',
                        'post_type'      => 'page',
                        'ping_status'    => 'closed',
                        'comment_status' => 'closed',
                    )
                );
            }
        }
    }
public static function plugin_activated ( ) { $ instance = self :: getInstance ( ) ; $ page_definitions = array ( $ instance -> pageSlug [ 'member-login' ] => array ( 'title' => __ ( 'Sign In' , 'intersynergy-login-plugin' ) , 'content' => '[intersynergy-login-form]' , ) , $ instance -> pageSlug [ 'member-account' ] => array ( 'title' => __ ( 'Your Account' , 'intersynergy-login-plugin' ) , 'content' => '[account-info]' , ) , $ instance -> pageSlug [ 'member-register' ] => array ( 'title' => __ ( 'Register' , 'intersynergy-login-plugin' ) , 'content' => '[intersynergy-register-form]' , ) , $ instance -> pageSlug [ 'member-password-lost' ] => array ( 'title' => __ ( 'Forgot Your Password?' , 'intersynergy-login-plugin' ) , 'content' => '[intersynergy-password-lost-form]' , ) , $ instance -> pageSlug [ 'member-password-reset' ] => array ( 'title' => __ ( 'Pick a New Password' , 'intersynergy-login-plugin' ) , 'content' => '[intersynergy-password-reset-form]' , ) , ) ; foreach ( $ page_definitions as $ slug => $ page ) { $ query = new WP_Query ( 'pagename=' . $ slug ) ; if ( ! $ query -> have_posts ( ) ) { wp_insert_post ( array ( 'post_content' => $ page [ 'content' ] , 'post_name' => $ slug , 'post_title' => $ page [ 'title' ] , 'post_status' => 'publish' , 'post_type' => 'page' , 'ping_status' => 'closed' , 'comment_status' => 'closed' , ) ) ; } } }
Plugin activation hook.
Plugin activation hook .
// Information needed for creating the plugin's pages // Check that the page doesn't exist already // Add the page using the data from the array above