} if (!$msg['error']) { $meta = get_post_meta($media_id, '_wp_attached_file'); $sizes = get_media_file_sizes($upload_dir . "/" . $meta[0]); $menu_order = count(tnb_get_artista_musicas($profileuser->ID)); $update = array('ID' => $media_id, 'menu_order' => $menu_order); wp_update_post($update); //$albuns = get_user_meta($current_user->ID, 'albuns'); update_post_meta($media_id, '_filesize', $sizes['filesize']); update_post_meta($media_id, '_playtime', $sizes['playtime']); update_post_meta($media_id, '_album', $_POST['music_album']); update_post_meta($media_id, '_download', $_POST['music_download'] ? 1 : 0); if ($_POST['music_principal'] || $menu_order == 0) { tnb_set_artista_musica_principal($profileuser->ID, $media_id); } tnb_cache_unset("ARTISTAS_MUSICAS", $profileuser->ID); } } else { $msg['error'][] = __('Tipo de arquivo não permitido', 'tnb'); } } break; case 'edit-musica-save': $update = array('ID' => $_POST['mid'], 'post_title' => $_POST['music_title']); wp_update_post($update); update_post_meta($_POST['mid'], '_album', $_POST['music_album']); update_post_meta($_POST['mid'], '_download', $_POST['music_download'] ? 1 : 0); if ($_POST['music_principal']) { tnb_set_artista_musica_principal($profileuser->ID, $_POST['mid']); } $msg['success'][] = __('Música atualizada', 'tnb');
<?php switch ($_REQUEST['tnb_user_action']) { case 'insert-video': if (strlen($_POST['video_url']) > 0 && (preg_match("/\\/watch\\?v=/", $_POST['video_url']) || preg_match("/vimeo.com\\/\\d+\$/", $_POST['video_url']))) { $post = array("post_title" => $_POST['video_title'], "post_content" => $_POST['video_content'], "post_excerpt" => $_POST['video_url'], "post_author" => $profileuser->ID, "post_type" => 'videos', "post_status" => 'publish'); $post_id = wp_insert_post($post); $menu_order = count(tnb_get_artista_videos($profileuser->ID)); if ($_POST['video_principal'] || $menu_order == 0) { tnb_set_artista_video_principal($profileuser->ID, $post_id); } tnb_cache_unset("ARTISTAS_VIDEOS", $profileuser->ID); } else { $msg['error'][] = __('URL do vídeo inválida. Use o endereço de um vídeo no youtube ou vimeo', 'tnb'); } break; case 'delete-video': if ($_GET['mid']) { if (current_user_can('delete_post', $_GET['mid'])) { wp_delete_post($_GET['mid']); } } break; case 'edit-video-save': if (strlen($_POST['video_url']) > 0 && (preg_match("/\\/watch\\?v=/", $_POST['video_url']) || preg_match("/vimeo.com\\/\\d+\$/", $_POST['video_url']))) { $update = array('ID' => $_POST['mid'], 'post_title' => $_POST['video_title'], 'post_content' => $_POST['video_description'], 'post_excerpt' => $_POST['video_url']); wp_update_post($update); if ($_POST['video_principal']) { tnb_set_artista_video_principal($profileuser->ID, $_POST['mid']); } } else {