function settings_display()
        {
            if (isset($_POST['thatcamp_registrations_save_changes'])) {
                $newOptions = array('open_registration' => $_POST['open_registration'], 'pending_application_email' => $_POST['pending_application_email'], 'approved_application_email' => $_POST['approved_application_email'], 'rejected_application_email' => $_POST['rejected_application_email']);
                $admin_notify_emails = $_POST['admin_notify_emails'];
                $admin_notify_emails = array_map('trim', explode("\n", $admin_notify_emails));
                $newOptions['admin_notify_emails'] = $admin_notify_emails;
                update_option('thatcamp_registrations_options', $newOptions);
                $fields = isset($_POST['fields']) ? $_POST['fields'] : array();
                update_option('thatcamp_registrations_selected_fields', $fields);
            }
            $options = thatcamp_registrations_options();
            ?>
        <div class="wrap">

            <h2><?php 
            echo _e('Settings for THATCamp Registrations', 'thatcamp-registrations');
            ?>
</h2>
            <h3><?php 
            echo _e('To enable registration, create a registration page and type the shortcode [thatcamp-registration] on the page.');
            ?>
</h3>

            <form action="" method="post">
                <table class="form-table">
                    <tr valign="top">
                        <th scope="row"><label for="open_registration"><?php 
            _e('Open registration?', 'thatcamp-registrations');
            ?>
</label></th>
                        <td>
                            <select name="open_registration">
                                <option value="0"><?php 
            _e('No');
            ?>
 </option>
                                <option value="1"<?php 
            if ($options['open_registration'] == 1) {
                echo ' selected="selected"';
            }
            ?>
><?php 
            _e('Yes');
            ?>
 </option>
                            </select>
                            <p class="description"><?php 
            _e('Before you open registration, create a page called (for instance) &#8220;Register&#8221; and type the shortcode &#x5b;thatcamp-registration&#x5d; on the page. When you open registrations, the registration form will be generated on that page. ', 'thatcamp-registrations');
            ?>
</p>
                        </td>
                    </tr>

		    <tr>
                        <th scope="row"><label for="admin_notify_emails"><?php 
            _e('Application notification addresses', 'thatcamp-registrations');
            ?>
</label></th>
                        <td>
                            <textarea name="admin_notify_emails"><?php 
            thatcamp_registrations_application_notification_emails_textarea();
            ?>
</textarea>

                            <p class="description"><?php 
            _e('These addresses will receive a notification whenever a new registration is submitted. One per line.', 'thatcamp-registrations');
            ?>
</p>
                        </td>
                    </tr>

                    <?php 
            /* Removing require login before registering because no one needs that. ?>
               <tr valign="top">
                   <th scope="row"><label for="require_login"><?php _e( 'Require login before registering?', 'thatcamp-registrations' ) ?></label></th>
                   <td>
                       <select name="require_login">
                           <option value="0"><?php _e('No'); ?> </option>
                           <option value="1"<?php if($options['require_login'] == 1) { echo ' selected="selected"';} ?>><?php _e('Yes'); ?> </option>
                       </select>
                       <p class="description"><?php _e('If &#8220;Yes&#8221; users will be required to log in before completing the registration form.'); ?></p>
                   </td>
               </tr>
               <?php */
            ?>


                    <?php 
            /* Removing auto-approve field until this feature works. ?>
               <tr valign="top">
                   <th scope="row"><label for="auto_approve_applications"><?php _e('Automatically approve registrations', 'thatcamp-registrations'); ?></label></th>
                   <td>
                       <input type="text" name="auto_approve_applications" value="<?php echo $options['auto_approve_applications']; ?>" />
                       <p class="description"><?php _e('If you wish THATCamp Registrations to automatically approve a certain number of registrations, fill in that number here. If left blank, or set to 0, no registrations will be automatically approved.', 'thatcamp-registrations'); ?></p>
                   </td>
               </tr>
               <?php */
            ?>
                    <tr valign="top">
                        <th scope="row"><label for="pending_application_email"><?php 
            _e('Pending registration email', 'thatcamp-registrations');
            ?>
</label></th>
                        <td>
                            <textarea name="pending_application_email" id="pending_application_email" rows="5" cols="50"><?php 
            if (!empty($options['pending_application_email'])) {
                echo stripslashes($options['pending_application_email']);
            }
            ?>
</textarea>
                            <p class="description"><?php 
            _e('This e-mail will be sent by the system from an automated account; you may therefore wish to include your own name and e-mail address in the message itself so that users may contact you. The e-mail will be composed in HTML format, so links and e-mail addresses will automatically be hyperlinked, and no additional HTML codes are necessary. If no text is entered, no e-mail will be sent.');
            ?>
</p>
                        </td>
                    </tr>
                    <tr valign="top">
                        <th scope="row"><label for="approved_application_email"><?php 
            _e('Approved registration email', 'thatcamp-registrations');
            ?>
</label></th>
                        <td>
                            <textarea name="approved_application_email" id="approved_application_email" rows="5" cols="50"><?php 
            if (!empty($options['approved_application_email'])) {
                echo stripslashes($options['approved_application_email']);
            }
            ?>
</textarea>
                             <p class="description"><?php 
            _e('This e-mail will be sent by the system from an automated account; you may therefore wish to include your own name and e-mail address in the message itself so that users may contact you. The e-mail will be composed in HTML format, so links and e-mail addresses will automatically be hyperlinked, and no additional HTML codes are necessary. If no text is entered, no e-mail will be sent.');
            ?>
</p>
                        </td>
                    </tr>
                    <tr valign="top">
                        <th scope="row"><label for="rejected_application_email"><?php 
            _e('Rejected registration email', 'thatcamp-registrations');
            ?>
</label></th>
                        <td>
                            <textarea name="rejected_application_email" id="rejected_application_email" rows="5" cols="50"><?php 
            if (!empty($options['rejected_application_email'])) {
                echo stripslashes($options['rejected_application_email']);
            }
            ?>
</textarea>
                            <p class="description"><?php 
            _e('This e-mail will be sent by the system from an automated account; you may therefore wish to include your own name and e-mail address in the message itself so that users may contact you. The e-mail will be composed in HTML format, so links and e-mail addresses will automatically be hyperlinked, and no additional HTML codes are necessary. If no text is entered, no e-mail will be sent.');
            ?>
</p>

                        </td>
                    </tr>

                    <tr valign="top">
                        <th scope="row"><?php 
            _e('Registration fields', 'thatcamp-registrations');
            ?>
</th>
                        <td>
				<?php 
            $fields = thatcamp_registrations_fields('all');
            ?>
				<?php 
            $selected = thatcamp_registrations_selected_fields();
            ?>
				<?php 
            foreach ($fields as $field) {
                ?>
					<?php 
                $checked = !empty($field['required']) || in_array($field['id'], $selected) ? ' checked="checked"' : '';
                $disabled = !empty($field['required']) ? ' disabled="disabled"' : '';
                ?>

					<input type="checkbox" name="fields[]" value="<?php 
                echo esc_attr($field['id']);
                ?>
"<?php 
                echo $checked;
                ?>
 <?php 
                echo $disabled;
                ?>
 /> <?php 
                echo esc_html($field['name']);
                ?>
 <?php 
                if ($disabled) {
                    ?>
<em><?php 
                    _e('(required)', 'thatcamp-registrations');
                    ?>
</em><?php 
                }
                ?>
<br />
				<?php 
            }
            ?>
			</td>
		    </tr>

                    <tr valign="top">
                        <th scope="row"></th>
                        <td>
                            <input type="submit" name="thatcamp_registrations_save_changes" class="button-primary" value="<?php 
            _e('Save Changes');
            ?>
" />
                        </td>
                    </tr>
                </table>
                <br />
            </form>
        </div>
    <?php 
        }
/**
 * Returns the value for a single THATCamp Registrations option.
 *
 * @uses thatcamp_registrations_options()
 * @param string The name of the option
 * @return string
 **/
function thatcamp_registrations_option($optionName)
{
    if (isset($optionName)) {
        $options = thatcamp_registrations_options();
        return isset($options[$optionName]) ? $options[$optionName] : '';
    }
    return false;
}