/**
  * display admin page for creating and managing temporary users
  *
  * @return null
  */
 public static function admin_settings()
 {
     // check our user permissions again
     if (false === TempAdminUser_Utilities::check_user_perm()) {
         echo __('You do not have permission to access this page.', 'temporary-admin-user');
         die;
     }
     // begin the markup for the settings page
     echo '<div class="wrap tempadmin-settings-wrap">';
     echo '<h2>' . __('Manage Temporary Users', 'temporary-admin-user') . '</h2>';
     // display our new user form
     echo '<div class="tempadmin-settings-box tempadmin-new-user-box">';
     echo '<h3>' . __('Create New User', 'temporary-admin-user') . '</h3>';
     echo TempAdminUser_Layout::new_user_form();
     echo '</div>';
     // display our existing active users
     echo '<div id="tempadmin-users-active" class="tempadmin-settings-box tempadmin-users-list-box">';
     echo '<form method="post">';
     echo '<div class="tempadmin-users-list-title-row">';
     echo '<h3>';
     echo '<span class="tempadmin-users-title-text">' . __('Active User Accounts', 'temporary-admin-user') . ' </span>';
     echo '<span class="tempadmin-users-list-action tempadmin-users-active-action">';
     echo TempAdminUser_Layout::user_action_button(__('Demote Selected Users', 'temporary-admin-user'), 'demote');
     echo '</span>';
     echo '</h3>';
     echo '</div>';
     echo '<div class="tempadmin-users-list-data">';
     echo TempAdminUser_Layout::existing_user_list('administrator');
     echo '</div>';
     echo '</form>';
     echo '</div>';
     // display our existing expired users
     echo '<div id="tempadmin-users-expired" class="tempadmin-settings-box tempadmin-users-list-box">';
     echo '<form method="post">';
     echo '<div class="tempadmin-users-list-title-row">';
     echo '<h3>';
     echo '<span class="tempadmin-users-title-text">' . __('Expired User Accounts', 'temporary-admin-user') . ' </span>';
     echo '<span class="tempadmin-users-list-action tempadmin-users-expired-action">';
     echo TempAdminUser_Layout::user_action_button(__('Delete Selected Users', 'temporary-admin-user'), 'delete');
     echo '</span>';
     echo '</h3>';
     echo '</div>';
     echo '<div class="tempadmin-users-list-data">';
     echo TempAdminUser_Layout::existing_user_list('subscriber');
     echo '</div>';
     echo '</form>';
     echo '</div>';
     // close the markup for the settings page
     echo '</div>';
 }
 /**
  * set up the new user notification email
  *
  * @param  integer $user      the newly created user ID or the entire object
  * @param  string  $password  the password assigned to the new user
  *
  * @return mixed              an HTML email with the new user info
  */
 protected static function new_user_notification($user = 0, $password = '')
 {
     // check if we recieved just the user ID and fetch the object
     if (is_numeric($user) && !is_object($user)) {
         $user = new WP_User($user);
     }
     // bail if somehow we didn't get a valid user object
     if (!is_object($user)) {
         return false;
     }
     // get our email content type
     $email_type = apply_filters('tempadmin_email_content_type', 'html');
     // fetch the site info, which we need for the email
     $sitedata = TempAdminUser_Utilities::get_site_data();
     // switch to HTML format unless otherwise told
     if ($email_type == 'html') {
         add_filter('wp_mail_content_type', array(__CLASS__, 'set_html_content_type'));
     }
     // construct email headers
     $headers = 'From: ' . esc_attr($sitedata['site-name']) . ' <' . sanitize_email($sitedata['admin-email']) . '>' . "\r\n";
     $headers .= 'Return-Path: ' . sanitize_email($sitedata['admin-email']) . "\r\n";
     // add the additional headers for HTML email
     if ($email_type == 'html') {
         $headers .= 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-Type: text/html; charset="UTF-8"' . "\r\n";
     }
     // set my email subject
     $subject = apply_filters('tempadmin_email_subject', __('New User Account', 'temporary-admin-user'));
     // get my user content
     $content = TempAdminUser_Layout::generate_email_content($user, $password, $sitedata);
     // and send the email
     wp_mail(sanitize_email($user->user_email), $subject, $content, $headers);
     // reset the email content type (if originally set )
     if ($email_type == 'html') {
         remove_filter('wp_mail_content_type', array(__CLASS__, 'set_html_content_type'));
     }
     // and return
     return;
 }