feat(submit): add video cover picker with playable video preview
Featured video preview now renders a real DPlayer (video-url/video-pic) like the reference theme instead of a static image, so the cover video plays on the submit page. Top-right bar gains the video-cover button shown only when a video cover is loaded; backend honors pic_id and no longer deletes the thumbnail before cover validation. Drop dead i18n keys and data-can-* attributes.
This commit is contained in:
@@ -48,20 +48,35 @@ trait FrontSubmitFeatured {
|
||||
if ($video_id > 0 && !$this->can_use_front_submit_video($video_id, $user_id)) {
|
||||
$video_id = 0;
|
||||
}
|
||||
$pic = esc_url_raw((string) ($payload['pic'] ?? ''));
|
||||
if ($pic !== '' && !$this->user_can_cap('upload_submit_image', $user_id)) {
|
||||
$pic = '';
|
||||
$pic_id = absint($payload['pic_id'] ?? 0);
|
||||
if ($pic_id > 0 && !$this->can_use_front_submit_image($pic_id, $user_id)) {
|
||||
$pic_id = 0;
|
||||
}
|
||||
$pic = '';
|
||||
if ($pic_id > 0) {
|
||||
$pic = (string) wp_get_attachment_image_url($pic_id, 'full');
|
||||
}
|
||||
if ($pic === '') {
|
||||
$pic = esc_url_raw((string) ($payload['pic'] ?? ''));
|
||||
if ($pic !== '' && !$this->can_use_front_submit_image_url($pic, $user_id)) {
|
||||
$pic = '';
|
||||
}
|
||||
}
|
||||
$post_meta['featured_video'] = $video;
|
||||
$post_meta['featured_video_attachment_id'] = $video_id;
|
||||
$post_meta['featured_slide'] = '';
|
||||
$post_meta['thumbnail_url'] = '';
|
||||
$post_meta['cover_image'] = '';
|
||||
delete_post_thumbnail($post_id);
|
||||
if ($pic !== '' && $this->can_use_front_submit_image_url($pic, $user_id)) {
|
||||
if ($pic !== '') {
|
||||
$post_meta['thumbnail_url'] = $pic;
|
||||
$post_meta['cover_image'] = $pic;
|
||||
$this->maybe_set_thumbnail_url($post_id, $pic);
|
||||
if ($pic_id > 0) {
|
||||
set_post_thumbnail($post_id, $pic_id);
|
||||
} else {
|
||||
$this->maybe_set_thumbnail_url($post_id, $pic);
|
||||
}
|
||||
} else {
|
||||
delete_post_thumbnail($post_id);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user