Estoy creando una carga de imágen en perfil de usuario, todo marcha bien se inserta la url de la imágen en el campo y todo, el problema es que no logro guardarlo, alquien sabe como?.
add_action
( 'show_user_profile',
'my_show_extra_profile_fields' );
add_action
( 'edit_user_profile',
'my_show_extra_profile_fields' );
function my_show_extra_profile_fields
( $user ) { ? >
< h3 >Cargar Avatar< /h3 >
< tr >
< th >< label
for=
"avatar" >Cargador< /label >< /th >
< td >< input style=
"margin-left:180px;" id=
"upload_image" class=
"regular-text" type=
"text" size=
"36" name=
"upload_image" value=
"< ?php echo $upload_image; ? >" / >
< input id=
"upload_image_button" type=
"button" value=
"Cargar imagen" / >< /td >
< /tr >
< ?php
}
function my_admin_scripts
() {
wp_enqueue_script
('media-upload');
wp_enqueue_script
('thickbox');
wp_register_script
('my-upload', get_bloginfo
('wpurl') .
'/wp-content/themes/biored/js/my-script.js',
array('jquery',
'media-upload',
'thickbox'));
wp_enqueue_script
('my-upload');
}
function my_admin_styles
() {
wp_enqueue_style
('thickbox');
}
add_action
('admin_print_scripts',
'my_admin_scripts');
add_action
('admin_print_styles',
'my_admin_styles');
add_action
('save_post',
'save_functions');
function save_functions
(){
global $post;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE
) {
return $post- >ID;
}
update_post_meta
($post- >ID,
"upload_image",
$_POST["upload_image"]);
}
Saludos