more admin cleanup

This commit is contained in:
John Bintz 2009-09-10 21:03:27 -04:00
parent ca75c5cf27
commit 2dcd244cf8
2 changed files with 11 additions and 19 deletions

View File

@ -292,8 +292,6 @@ class WhatDidTheySayAdmin {
$updated = false; $updated = false;
if (current_user_can('edit_users')) { if (current_user_can('edit_users')) {
$options = get_option('what-did-they-say-options'); $options = get_option('what-did-they-say-options');
switch ($info['action']) {
case "capabilities":
if (isset($info['capabilities'])) { if (isset($info['capabilities'])) {
foreach (array_keys($this->default_options['capabilities']) as $capability) { foreach (array_keys($this->default_options['capabilities']) as $capability) {
if (isset($info['capabilities'][$capability])) { if (isset($info['capabilities'][$capability])) {
@ -302,8 +300,6 @@ class WhatDidTheySayAdmin {
} }
$updated = __('User capabilities updated.', 'what-did-they-say'); $updated = __('User capabilities updated.', 'what-did-they-say');
} }
break;
}
if ($updated !== false) { if ($updated !== false) {
update_option('what-did-they-say-options', $options); update_option('what-did-they-say-options', $options);
} }
@ -319,13 +315,9 @@ class WhatDidTheySayAdmin {
function handle_update_reset_options($info) { function handle_update_reset_options($info) {
$updated = false; $updated = false;
if (current_user_can('manage_options')) { if (current_user_can('manage_options')) {
switch ($info['action']) {
case "reset_options":
delete_option('what-did-they-say-options'); delete_option('what-did-they-say-options');
$this->install(); $this->install();
$updated = __('<strong>What Did They Say?!?</strong> options reset.', 'what-did-they-say'); $updated = __('<strong>What Did They Say?!?</strong> options reset.', 'what-did-they-say');
break;
}
} }
return $updated; return $updated;
} }

View File

@ -4,7 +4,7 @@
<?php if (current_user_can('edit_users') && is_array($options)) { ?> <?php if (current_user_can('edit_users') && is_array($options)) { ?>
<form method="post"> <form method="post">
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<input type="hidden" name="wdts[action]" value="capabilities" /> <input type="hidden" name="wdts[module]" value="capabilities" />
<h3><?php _e('Capabilities', 'what-did-they-say') ?></h3> <h3><?php _e('Capabilities', 'what-did-they-say') ?></h3>
<table class="widefat fixed"> <table class="widefat fixed">
@ -110,7 +110,7 @@
<p><?php _e('Click the button below to reset capabilities and languages to their defaults. This will not affect any transcriptions you have already created, but some transcriptions may become inaccessible if you don\'t redefine the original language.', 'what-did-they-say') ?></p> <p><?php _e('Click the button below to reset capabilities and languages to their defaults. This will not affect any transcriptions you have already created, but some transcriptions may become inaccessible if you don\'t redefine the original language.', 'what-did-they-say') ?></p>
<form method="post" id="reset-wdts"> <form method="post" id="reset-wdts">
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<input type="hidden" name="wdts[action]" value="reset_options" /> <input type="hidden" name="wdts[module]" value="reset-options" />
<input type="submit" class="button" value="<?php _e('Reset What Did They Say?!?', 'what-did-they-say') ?>" /> <input type="submit" class="button" value="<?php _e('Reset What Did They Say?!?', 'what-did-they-say') ?>" />
</form> </form>
<?php } ?> <?php } ?>