Okay, so if I understand you correctly I should change the way my form, that I have in functions.php saves the metadata about the author image.
This is how the function that adds the extra fields on the options page of WordPress looks:
/Extrainfo bloggare
$new_general_setting = new new_general_setting();
class new_general_setting {
function new_general_setting() {
add_filter('admin_init', array(
&$this,
'register_fields'
));
add_action('admin_init', array(
&$this,
'load_scripts'
));
}
function register_fields() {
register_setting('general', 'profilbild', 'esc_attr');
add_settings_field('profil_bild', '<label for="profilbild">' . __('Profilbild', 'profilbild') . '</label>', array(
&$this,
'field_profilbild'
), 'general');
register_setting('general', 'toppbanner', 'esc_attr');
add_settings_field('topp_banner', '<label for="toppbanner">' . __('Toppbanner', 'toppbanner') . '</label>', array(
&$this,
'field_toppbanner'
), 'general');
}
function load_scripts() {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
}
function field_profilbild() {
$value = get_option('profilbild', '');
echo '<input type="text" id="profilbild" name="profilbild" value="' . $value . '" /><input type="button" id="upload_pic_button1" class="upload-button" value="L?gg till" />';
?>
<script type="text/javascript">
jQuery(document).ready(function() {
var uploadID = ''; /*setup the var*/
jQuery('.upload-button').click(function() {
uploadID = jQuery(this).prev('input'); /*grab the specific input*/
formfield = jQuery('.upload').attr('name');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;
});
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
uploadID.val(imgurl); /*assign the value to the input*/
tb_remove();
};
});
</script>
<?php
}
function field_toppbanner() {
$value = get_option('toppbanner', '');
echo '<input type="text" id="toppbanner" name="toppbanner" value="' . $value . '" /><input type="button" id="upload_pic_button2" class="upload-button" value="L?gg till" />';
}
}
Should I somewhere in here specify where in the database the image information should be saved?