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

View File

@ -4,7 +4,7 @@
<?php if (current_user_can('edit_users') && is_array($options)) { ?>
<form method="post">
<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>
<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>
<form method="post" id="reset-wdts">
<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') ?>" />
</form>
<?php } ?>