function wind_settingsPage() { global $wpdb, $wp_rewrite; $wind_wp_path = explode("wp-content/", dirname(__FILE__)); add_contextual_help($current_screen, '<p>' . __('Include contextual help here') . '</p>' . '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://wordpress.org/support/">Support Forums</a>') . '</p>'); # process updates on post if ($_SERVER['REQUEST_METHOD'] == 'POST') { wind_processUpdates(); } # now all the site options are available as variables extract(wind_getSiteOptions()); # check for "updated" on get if (isset($_GET['updated'])) { ?> <div id="message" class="updated"><p><?php _e('Options saved.'); ?> </p></div> <?php } ?> <div class="wrap"> <h2>WIND Settings Page</h2> <form method="post" id="wind_wind_settings"> <?php wp_nonce_field('siteoptions'); ?> <h3><?php _e('General Settings'); ?> </h3> <table class="form-table"> <tr valign="top" id="windenableplugin"> <th scope="row"><?php _e('Enable the plugin to allow WIND login?'); ?> </th> <td> <input type='radio' name='wind_enable_plugin' id='wind_enable_plugin_yes' value='1' <?php echo $wind_enable_plugin_checked; ?> /> <label for="wind_enable_plugin_yes">Yes</label> <input type='radio' name='wind_enable_plugin' id='wind_enable_plugin_no' value='0' <?php echo $wind_enable_plugin_unchecked; ?> /> <label for="wind_enable_plugin_no">No</label> </td> </tr> <tr valign="top"> <th scope="row"><label for="wind_super_admins"><?php _e('Super Admins'); ?> </label></th> <td> <input name="wind_super_admins" type="text" id="wind_super_admins" class="large-text" value="<?php echo $wind_super_admins; ?> " size="80" /> <br /> <?php _e('Enter a list of unis separated by spaces to grant users super admin status automatically when they\'re first provisioned.'); ?> </td> </tr> <tr valign="top"> <th scope="row"><label for="wind_help_email"><?php _e('Help email address'); ?> </label></th> <td> <input name="wind_help_email" type="text" id="wind_help_email" class="regular-text" value="<?php echo $wind_help_email; ?> " /> <br /> <?php _e('If users encounter an error, they will be requested to email this address.'); ?> </td> </tr> <tr valign="top"> <th scope="row"><label for="wind_log_file"><?php _e('Log file location'); ?> </label></th> <td> <input name="wind_log_file" type="text" id="wind_log_file" class="large-text" value="<?php echo $wind_log_file; ?> " size="80" /> <br /> <?php _e('Save a provisioning log.'); ?> </td> </tr> </table> <h3><?php _e('Course Affiliations (Optional)'); ?> </h3> <table class="form-table"> <tr valign="top" id="checkcourseaffils"> <th scope="row"><?php _e('Check Course Affiliations?'); ?> </th> <td> <input type='radio' name='wind_check_course_affils' id='wind_check_course_affils_yes' value='1' <?php echo $wind_check_course_affils_checked; ?> /> <label for="wind_check_course_affils_yes">Yes</label> <input type='radio' name='wind_check_course_affils' id='wind_check_course_affils_no' value='0' <?php echo $wind_check_course_affils_unchecked; ?> /> <label for="wind_check_course_affils_no">No</label> </td> </tr> <tr valign="top"> <th scope="row"><label for="wind_nra_list_location"><?php _e('NRA List Location'); ?> </label></th> <td> <input name="wind_nra_list_location" type="text" id="wind_nra_list_location" class="regular-text" value="<?php echo $wind_nra_list_location; ?> " /> <br /> <?php _e('Location of the non-registered attendees file.'); ?> </td> </tr> </table> <h3><?php _e('WIND Server Settings'); ?> </h3> <table class="form-table"> <tr valign="top" id="wind_service_name"> <th scope="row"><?php _e('WIND Service Name'); ?> </th> <td> <input name="wind_service_name" type="text" id="wind_service_name" class="regular-text" value="<?php echo $wind_service_name; ?> " /> </td> </tr> <tr valign="top" id="wind_server"> <th scope="row"><?php _e('WIND Server'); ?> </th> <td> <input name="wind_server" type="text" id="wind_server" class="regular-text" value="<?php echo $wind_server; ?> " /> </td> </tr> <tr valign="top" id="wind_login_uri"> <th scope="row"><?php _e('WIND Login URI'); ?> </th> <td> <input name="wind_login_uri" type="text" id="wind_login_uri" class="regular-text" value="<?php echo $wind_login_uri; ?> " /> </td> </tr> <tr valign="top" id="wind_logout_uri"> <th scope="row"><?php _e('WIND Logout URI'); ?> </th> <td> <input name="wind_logout_uri" type="text" id="wind_logout_uri" class="regular-text" value="<?php echo $wind_logout_uri; ?> " /> </td> </tr> <tr valign="top" id="wind_validate_uri"> <th scope="row"><?php _e('WIND Validate URI'); ?> </th> <td> <input name="wind_validate_uri" type="text" id="wind_validate_uri" class="regular-text" value="<?php echo $wind_validate_uri; ?> " /> </td> </tr> </table> <input type="hidden" name="wind_has_settings" value=1 /> <input type="hidden" name="wind_update_now" value=1 /> <input type="hidden" name="action" value="update" /> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?> " /> </p> </form> </div> <?php }
Plugin Name: Columbia WIND Logins Plugin URI: http://wiki.cul.columbia.edu/ Description: Allows WIND login to WP 3.0 Version: 1.1 Author: Nada O'Neal License: Apache 2 (http://www.apache.org/licenses/LICENSE-2.0.html) */ require_once "wind_plugin/wind_defaults.php"; require_once "wind_plugin/wind_functions.php"; require_once "wind_plugin/wind_pages.php"; date_default_timezone_set("America/New_York"); // add links to "Super Admin Menu" for provisioning users and changing wind settings add_action('admin_menu', 'wind_addProvisionUsersPage'); add_action('admin_menu', 'wind_addSettingsPage'); # get all the currently stored wind site options extract(wind_getSiteOptions()); // get the base directory for the wp install; used various places $wind_wp_path_pieces = explode("wp-content/", dirname(__FILE__)); $WIND_WP_PATH = $wind_wp_path_pieces[0]; #trigger_error("Abs path is $WIND_WP_PATH", E_USER_WARNING); // plugin hooks into authentication system if ($wind_enable_plugin) { add_action('wp_authenticate', 'wind_authenticate', 10, 2); add_action('wp_logout', 'wind_logout'); add_action('lost_password', 'disable_function'); add_action('retrieve_password', 'disable_function'); add_action('password_reset', 'disable_function'); add_filter('show_password_fields', 'wind_show_password_fields'); add_filter('wpmu_welcome_notification', 'wp_new_user_notification'); } // suppress the welcome email
/** * windlogger() sends to the wind log file */ function windlogger($message) { extract(wind_getSiteOptions()); $timestamp = date("m/d/y H:i:s"); error_log("{$message} at {$timestamp}\n", 3, $wind_log_file); }