basic transcription saving working
This commit is contained in:
parent
f962cc2436
commit
3a0d0572d5
@ -84,7 +84,7 @@ class WhatDidTheySayAdmin {
|
|||||||
function admin_notices() {
|
function admin_notices() {
|
||||||
if (!empty($this->notices)) {
|
if (!empty($this->notices)) {
|
||||||
echo '<div class="updated fade">';
|
echo '<div class="updated fade">';
|
||||||
echo implode("<br />", $this->notices);
|
foreach ($this->notices as $notice) { echo "<p>" . $notice . "</p>"; }
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,9 +98,27 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_update_languages($language_info) {
|
function handle_update_post_transcripts($post_transcript_info) {
|
||||||
$options = get_option('what-did-they-say-options');
|
|
||||||
$updated = false;
|
$updated = false;
|
||||||
|
if (current_user_can('approve_transcriptions')) {
|
||||||
|
$options = get_option('what-did-they-say-options');
|
||||||
|
|
||||||
|
switch ($post_transcript_info['action']) {
|
||||||
|
case "manage_post_transcripts":
|
||||||
|
foreach ($post_transcript_info['transcripts'] as $language => $transcript) {
|
||||||
|
$this->what_did_they_say->save_transcript($post_transcript_info['post_id'], $language, $transcript);
|
||||||
|
}
|
||||||
|
$updated = __('Transcripts updated', 'what-did-they-say');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle_update_languages($language_info) {
|
||||||
|
$updated = false;
|
||||||
|
if (current_user_can('change_languages')) {
|
||||||
|
$options = get_option('what-did-they-say-options');
|
||||||
switch ($language_info['action']) {
|
switch ($language_info['action']) {
|
||||||
case "delete":
|
case "delete":
|
||||||
$updated = sprintf(__('%s deleted.', 'what-did-they-say'), $options['languages'][$language_info['code']]['name']);
|
$updated = sprintf(__('%s deleted.', 'what-did-they-say'), $options['languages'][$language_info['code']]['name']);
|
||||||
@ -134,14 +152,18 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ($updated !== false) {
|
||||||
ksort($options['languages']);
|
ksort($options['languages']);
|
||||||
update_option('what-did-they-say-options', $options);
|
update_option('what-did-they-say-options', $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $updated;
|
return $updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_update_capabilities($capabilities_info) {
|
function handle_update_capabilities($capabilities_info) {
|
||||||
$options = get_option('what-did-they-say-options');
|
|
||||||
$updated = false;
|
$updated = false;
|
||||||
|
if (current_user_can('edit_users')) {
|
||||||
|
$options = get_option('what-did-they-say-options');
|
||||||
switch ($capabilities_info['action']) {
|
switch ($capabilities_info['action']) {
|
||||||
case "capabilities":
|
case "capabilities":
|
||||||
if (isset($capabilities_info['capabilities'])) {
|
if (isset($capabilities_info['capabilities'])) {
|
||||||
@ -154,7 +176,10 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ($updated !== false) {
|
||||||
update_option('what-did-they-say-options', $options);
|
update_option('what-did-they-say-options', $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $updated;
|
return $updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<iuput type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
|
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
|
||||||
<iuput type="hidden" name="wdts[action]" value="manage_post_transcripts" />
|
<input type="hidden" name="wdts[action]" value="manage_post_transcripts" />
|
||||||
|
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
Edit transcript for:
|
Edit transcript for:
|
||||||
|
Loading…
Reference in New Issue
Block a user