function supporter_message()
 {
     global $pagenow;
     if (is_super_admin()) {
         //don't filter siteadmin
         return;
     }
     //
     if (function_exists('is_pro_site') && $pagenow == 'plugins.php') {
         if (!is_pro_site()) {
             supporter_feature_notice();
         } else {
             echo '<div class="error" style="background-color:#F9F9F9;border:0;font-weight:bold;"><p>As a ' . get_site_option('site_name') . " Pro Site, you now have access to all our premium plugins!</p></div>";
         }
     }
     return;
 }
    /**
     * Display plugin admin page
     *
     **/
    function page_output()
    {
        global $wpdb;
        // display error message if supporter only
        if (!$this->is_supporter() && 'yes' == $this->supporter_only) {
            supporter_feature_notice();
            return;
        }
        // display message when successful
        if (isset($_GET['updated'])) {
            echo '<div id="message" class="updated fade"><p>' . urldecode($_GET['updatedmsg']) . '</p></div>';
        }
        echo '<div class="wrap">';
        $action = isset($_GET['action']) ? $_GET['action'] : '';
        switch ($action) {
            case 'process_queue':
                // process queue from database
                check_admin_referer('add-new-users-process_queue_new_users');
                echo '<p>' . __('Adding Users...', 'add_new_users') . '</p>';
                $this->queue_process($wpdb->blogid, $wpdb->siteid);
                $queue_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->base_prefix}add_new_users_queue WHERE add_new_users_site_ID = '%d' AND add_new_users_blog_ID = '%d'", $wpdb->siteid, $wpdb->blogid));
                if ($queue_count > 0) {
                    echo '<script language=\'javascript\'>window.location=\'' . htmlspecialchars_decode(wp_nonce_url('users.php?page=add-new-users&action=process_queue', 'add-new-users-process_queue_new_users')) . '\';</script>';
                } else {
                    echo '<script language=\'javascript\'>window.location=\'users.php?page=add-new-users&updated=true&updatedmsg=' . urlencode(__('Users Added.', 'add_new_users')) . '\';</script>';
                }
                break;
            case 'process':
                // add entries to queue
                if (isset($_POST['Cancel'])) {
                    echo "<script language='javascript'>window.location='users.php?page=add-new-users';</script>";
                }
                $batch_ID = md5($wpdb->blogid . time() . '0420i203zm');
                $errors = '';
                $error_fields = '';
                $error_messages = '';
                $global_errors = 0;
                $add_new_users_items = '';
                // validate users names, emails and passwords
                for ($counter = 1; $counter <= $this->fields; $counter += 1) {
                    $user_login = stripslashes($_POST['user_login_' . $counter]);
                    $user_email = stripslashes($_POST['user_email_' . $counter]);
                    $user_password = stripslashes($_POST['user_password_' . $counter]);
                    $user_role = stripslashes($_POST['user_role_' . $counter]);
                    $error = 0;
                    $error_field = '';
                    $error_msg = '';
                    if (!empty($user_email) || !empty($user_login)) {
                        // validate user email and login
                        $validate_user = $this->validate_user_signup($user_login, $user_email);
                        if (is_wp_error($validate_user_errors = $validate_user['errors']) && !empty($validate_user['errors']->errors)) {
                            foreach ($validate_user_errors->get_error_codes() as $error_code) {
                                $error_field = $error_code;
                                $error_msg = $validate_user_errors->errors[$error_code][0];
                                $error = 1;
                            }
                        }
                        // validate password
                        if (!empty($user_password)) {
                            if (false !== strpos(stripslashes($user_password), ' ')) {
                                $error = 1;
                                $error_field = 'user_password';
                                $error_msg = __('Passwords cannot contain spaces', 'add_new_users');
                            }
                            if (false !== strpos(stripslashes($user_password), '\\')) {
                                $error = 1;
                                $error_field = 'user_password';
                                $error_msg = __('Passwords may not contain the character "\\".', 'add_new_users');
                            }
                        } else {
                            $user_password = '******';
                        }
                        $add_new_users_items[$counter]['user_login'] = $validate_user['user_name'];
                        $add_new_users_items[$counter]['user_email'] = $validate_user['user_email'];
                        $add_new_users_items[$counter]['user_password'] = $user_password;
                        $add_new_users_items[$counter]['user_role'] = $user_role;
                        $errors[$counter] = $error;
                        $error_fields[$counter] = $error_field;
                        $error_messages[$counter] = $error_msg;
                        if (1 == $error) {
                            $global_errors = $global_errors + 1;
                        }
                    }
                }
                // if there are errors, display them
                if ($global_errors > 0) {
                    echo '<h2>' . __('Add New Users', 'add_new_users') . '</h2>';
                    echo '<div class="message error"><p>' . __('Errors were found. Please fix the errors and hit Next.', 'add_new_users') . '</p></div>';
                    if (!empty($_GET['fields'])) {
                        echo "<form name='form1' method='POST' action='users.php?page=add-new-users&action=process&fields={$_GET['fields']}'>";
                    } else {
                        echo '<form name="form1" method="POST" action="users.php?page=add-new-users&action=process">';
                    }
                    wp_nonce_field('add-new-users-process_new_users');
                    $this->formfields($errors, $error_messages);
                    ?>
					<p class="submit">
					<input type="submit" name="Submit" value="<?php 
                    _e('Next', 'add_new_users');
                    ?>
" />
					<input type="submit" name="Cancel" value="<?php 
                    _e('Cancel', 'add_new_users');
                    ?>
" />
					</p>
					<p style="text-align:right;"><?php 
                    _e('This may take some time so please be patient.', 'add_new_users');
                    ?>
</p>
					</form>
					<?php 
                    // if names, emails and passwords are all goods, add them to queue
                } else {
                    check_admin_referer('add-new-users-process_new_users');
                    // process
                    if (count($add_new_users_items) > 0 && is_array($add_new_users_items)) {
                        echo '<p>' . __('Adding Users...', 'add_new_users') . '</p>';
                        foreach ($add_new_users_items as $add_new_users_item) {
                            $this->queue_insert($batch_ID, $add_new_users_item['user_login'], $add_new_users_item['user_email'], $add_new_users_item['user_password'], $add_new_users_item['user_role']);
                        }
                    }
                    $queue_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->base_prefix}add_new_users_queue WHERE add_new_users_site_ID = '%d' AND add_new_users_blog_ID = '%d'", $wpdb->siteid, $wpdb->blogid));
                    if ($queue_count > 0) {
                        echo '<script language=\'javascript\'>window.location=\'' . htmlspecialchars_decode(wp_nonce_url('users.php?page=add-new-users&action=process_queue', 'add-new-users-process_queue_new_users')) . '\';</script>';
                    } else {
                        echo '<script language=\'javascript\'>window.location=\'users.php?page=add-new-users\';</script>';
                    }
                }
                break;
            default:
                echo '<h2>' . __('Add New Users', 'add_new_users') . '</h2>';
                echo '<p>' . __('This tool allows you to create new users on this site and add them to this blog.', 'add_new_users') . '</p>';
                echo class_exists('Add_Users') ? '<p>' . __('To add users that have already been created, please use the <a href="users.php?page=add-users">Add Users functionality here</a>.', 'add_new_users') . '</p>' : '';
                echo '<p>' . __('To add the new users simply enter the username you\'d like to give them (please choose carefully as it cannot be changed), their email address and - should you so choose - a password for them.', 'add_new_users') . '</p>';
                echo '<p>' . __('You may also select the level that you wish them to access to the site - you can find out more about different levels of access <a href="http://help.edublogs.org/2009/08/24/what-are-the-different-roles-of-users/">here</a>.', 'add_new_users') . '</p>';
                echo '<p>' . __('If you do not enter a password a random one will be generated for them.', 'add_new_users') . '</p>';
                echo '<p>' . __('All new users will receive an email containing their new username, password and login link.', 'add_new_users') . '</p>';
                $fields = !empty($_GET['fields']) ? "&fields={$_GET['fields']}" : '';
                echo "<form name='form1' method='POST' action='users.php?page=add-new-users&action=process{$fields}'>";
                wp_nonce_field('add-new-users-process_new_users');
                $this->formfields();
                ?>
				<p class="submit">
				<input <?php 
                if (!$this->is_supporter() && $this->supporter_only == 'yes') {
                    echo 'disabled="disabled"';
                }
                ?>
 type="submit" name="Submit" value="<?php 
                _e('Next', 'add_new_users');
                ?>
" />
				</p>
				<p style="text-align:right;"><?php 
                _e('This may take some time so please be patient.', 'add_new_users');
                ?>
</p>
				</form>
				<?php 
                break;
        }
        echo '</div>';
    }