Another useful change to the admin.php page – line #120, from
<option value="<?php echo $user->ID; ?>" <?php if(esc_attr( get_option('yt_to_posts_author') ) === $user->ID){ echo 'selected'; } ?> ><?php echo $user->display_name; ?></option>
to
<option value="<?php echo $user->ID; ?>" <?php if( strval($user->ID) === get_option('yt_to_posts_author')){ echo 'selected="selected"'; } ?> ><?php echo $user->display_name; ?></option>
Reason for this change: the selected WordPress user was not showing up in the select box after save, even though the yt_to_posts_author value was correctly changed and saved.
One more: change line #158 in script.js from
jQuery('#loadMore, #approveAllBtn').addClass('hidden');
to
jQuery('#loadMore').addClass('hidden');
so that the ‘Approve all listed videos’ button is not hidden upon loading a secondary page of videos.
Also – for
$youtube->playlistItems->listPlaylistItems('snippet', $args);
the videoId doesn’t need to be parsed out of the image url like so:
$pattern = '/\/vi\/(.*)\//';
preg_match($pattern, $newResult['thumb_url'], $matches, PREG_OFFSET_CAPTURE, 3);
$newResult['id'] = $matches[1][0];
– you can simply access it under
$searchResult['snippet']['resourceId']['videoId'];
Hi @rynokins,
Thanks for pointing this up. I’ll will take a look into all of this for the next update.
Best regards,
Enguerran
I don’t know why you put a plugin that doesn’t work well!!!
Next time try to debug before!!
Thank you so much @rynokin, you saved my day