YouTube Channel - Version 3.0.4

Version Description

(2015-05-11) = * Add: Tip what to do if error ocurred with YouTube Data API Key printed inside YTC ERROR comment * Change: Where to ask for support links in widget * Change: Timeout for getting feed increased from 2 to 5 seconds * Change: Update FAQ sections in readme file * Remove: Check for Redux Framework in debug JSON generator

Download this release

Release Info

Developer urkekg
Plugin Icon YouTube Channel
Version 3.0.4
Comparing to
See all releases

Code changes from version 3.0.3 to 3.0.4

Files changed (3) hide show
  1. inc/widget.php +1 -1
  2. readme.txt +63 -21
  3. youtube-channel.php +13 -7
inc/widget.php CHANGED
@@ -209,7 +209,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
209
  </p>
210
 
211
  <h4><?php _e('Does not work? Contact support!', 'youtube-channel'); ?></h4>
212
- <p><small><a href="?ytc_debug_json_for=<?php echo $this->id; ?>" target="_blank"><?php _e('Get JSON file', 'youtube-channel'); ?></a> <?php printf(__('and send it to %s or to <a href="%s" target="_support">support forum</a>.', 'youtube-channel'), '<a href="mailto:urke.kg@gmail.com?subject=YTC%20debug%20log%20for%20'.get_home_url().'">urke.kg@gmail.com</a>', 'http://wordpress.org/support/plugin/youtube-channel'); ?></small>
213
  </p>
214
 
215
  <?php
209
  </p>
210
 
211
  <h4><?php _e('Does not work? Contact support!', 'youtube-channel'); ?></h4>
212
+ <p><small><a href="?ytc_debug_json_for=<?php echo $this->id; ?>" target="_blank"><?php _e('Get JSON file', 'youtube-channel'); ?></a> <?php printf(__('and send it to <a href="%s" target="_support">support forum</a> with other details noted in <a href="%s" target=_blank">this article</a>.', 'youtube-channel'), 'http://wordpress.org/support/plugin/youtube-channel', 'https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug'); ?></small>
213
  </p>
214
 
215
  <?php
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
  Tested up to: 4.2.2
7
- Stable tag: 3.0.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -140,6 +140,17 @@ Learn more about [Obtaining authorization credentials](https://developers.google
140
 
141
  [youtube http://www.youtube.com/watch?v=8NlXV77QO8U]
142
 
 
 
 
 
 
 
 
 
 
 
 
143
  When you generate your own YouTube Data API Key, edit wp-config.php file and find line
144
 
145
  `/* That's all, stop editing! Happy blogging. */`
@@ -150,42 +161,65 @@ Insert above that line code
150
  just replace keyword <strong>YOUR_API_KEY</strong> with your real API Key previously generated (surround API key to single quotes). For example, if your key is **AIzaCuBWKZLyQthAgV3ofeYtCwrMSYvm6tX8IEY** then that line should be:
151
  `define('YOUTUBE_DATA_API_KEY', 'AIzaCuBWKZLyQthAgV3ofeYtCwrMSYvm6tX8IEY');`
152
 
 
 
 
153
  == Frequently Asked Questions ==
154
 
155
- = I set more than one items to fetch, but only one video is displayed. How to fix this? =
156
 
157
- Below option `Fetch ... video(s)` you can find `Show ... video(s)` since version 2.0.0. Here you can set number of videos to display.
158
 
159
- = How to get playlist ID? =
160
 
161
- Playlist ID can be manualy extracted from YouTube playlist URL. Part of strings after `&list=` that begins with uppercase letters `PL` represent playlist ID. You can paste ID with or without leading `PL` string.
162
 
163
- Since version 1.3.1 you can also paste full YouTube playlist URL and ID will be automaticaly extracted.
 
 
 
 
164
 
165
- = How to fix error `Invalid value for parameter: username` =
166
 
167
- Double check YouTube Channel ID which you set in widget/settings. Channel ID (username) should not contain spaces.
 
 
 
 
168
 
169
- = How to force embeding 320p video with better audio quality? =
170
 
171
- YouTube provide 320p videos if height of embeded video is set to 320 or more. If you use small YTC video size, 240p will be loaded instead. So, you could not force 720p in tiny YTC.
 
 
 
 
 
 
 
 
 
 
172
 
173
- = What is a difference between `Fetch latest` and `Show ... videos`? =
174
 
175
- Value for `Fetch latest` says how many items will containt videos feed for choosing random video.
176
- Value for `Show ... videos` says how many videos will be displayed in widget.
177
 
178
- = In wich way does the plugin order the videos? Not by the time they were uploaded... =
179
 
180
- By default, YTC sort videos by publishing date/time, not by uploaded date/time.
181
 
182
- If you have enabled option `Fix No items error/Respect playlist order`, then videos are not sorted by publishing date, but by YouTube default order.
183
 
184
- = When I upload a new video to youtube, it is not in the list at my site =
185
 
186
- Video feed for YTC has been retreived with standard youtube feed [uploads by specified user](https://developers.google.com/youtube/2.0/developers_guide_protocol?hl=en#User_Uploaded_Videos "User Uploaded Videos"), and as Google say: [uploaded videos will be included in a user's public uploaded videos feed a few minutes after the upload completes and YouTube finishes processing the video](https://developers.google.com/youtube/2.0/reference#Latency_Information).
187
 
188
- If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
 
 
 
 
189
 
190
  = I enabled option `Hide YT Logo` but YouTube logo is still visible =
191
 
@@ -193,14 +227,15 @@ Modestbranding option does not work for all videos, so a lot of videos will stil
193
 
194
  Also, even when hidding logo works for your video, on hover or when video is paused in upper right corner will be displayed YouTube link/logo. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
195
 
196
- = How I can achieve wall layout with one featured thumbnail? =
197
 
198
  You can try with shortcode combination:
199
  `[youtube_channel num=7 responsive=1 class=ytc_wall_1-6 resource=2 random=1]`
200
 
201
  and custom CSS code added to theme style.css or similar customization:
202
  `.youtube_channel.ytc_wall_1-6 .ytc_video_container {
203
- padding: 10px;
 
204
  }
205
  .youtube_channel.ytc_wall_1-6 .ytc_video_container:not(:first-child) {
206
  max-width: 33.333%;
@@ -220,6 +255,13 @@ So, we display thumbnails for 7 random videos from default (global) playlist, an
220
 
221
  == Changelog ==
222
 
 
 
 
 
 
 
 
223
  = 3.0.3 (2015-05-10) =
224
  * Fix: "Ups, something went wrong." when Playlist selected as resource because wrong switch
225
  * Fix: Jumping thumbnails in responsive wall on hover in Twenty Fifteen theme because border-bottom for anchors
4
  Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
  Tested up to: 4.2.2
7
+ Stable tag: 3.0.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
140
 
141
  [youtube http://www.youtube.com/watch?v=8NlXV77QO8U]
142
 
143
+ 1. Visit [Google Developers Console](https://console.developers.google.com/project)
144
+ 1. If you don't have any project, create new one. Name it so you can recognize it (for example **My WordPress Website**).
145
+ 1. Select your new project and from LHS sidebar expand group **APIs & auth**, then select item **APIs**
146
+ 1. Locate and click **YouTube Data API** under **YouTube API** section
147
+ 1. Click **Enable API** button
148
+ 1. When you get enabled YouTube Data API in your project, click **Credentials** item from LHS menu **APIs & auth**
149
+ 1. Click **Create New Key** button and select **Browser Key**
150
+ 1. Leave empty or enter domain name of your website with wildcards. If you get message **Ups, something went wrong.** try to tune referer with wildcars (I did not success in that) or leave any restriction.
151
+ 1. Click **Create** button
152
+ 1. Copy newly created **API Key**
153
+
154
  When you generate your own YouTube Data API Key, edit wp-config.php file and find line
155
 
156
  `/* That's all, stop editing! Happy blogging. */`
161
  just replace keyword <strong>YOUR_API_KEY</strong> with your real API Key previously generated (surround API key to single quotes). For example, if your key is **AIzaCuBWKZLyQthAgV3ofeYtCwrMSYvm6tX8IEY** then that line should be:
162
  `define('YOUTUBE_DATA_API_KEY', 'AIzaCuBWKZLyQthAgV3ofeYtCwrMSYvm6tX8IEY');`
163
 
164
+ Also, do not forget to check and update **Channel ID** in plugin's General Settings, Widgets and shortcodes.
165
+ You can get **Channel ID** from page [Account Advanced](https://www.youtube.com/account_advanced) page while you're loagged in to your account.
166
+
167
  == Frequently Asked Questions ==
168
 
169
+ = How to get that YouTube Data API Key? =
170
 
171
+ Please folllow [Installation](https://wordpress.org/plugins/youtube-channel/installation/) instructions.
172
 
173
+ = I set everything correct but receiveing 'Ups, something went wrong' message =
174
 
175
+ Right click that message on your website and look for HTML comment below it, message will look like this:
176
 
177
+ `<!-- YTC ERROR:
178
+ domain: youtube.search
179
+ reason: invalidChannelId
180
+ message: Invalid channel.
181
+ -->`
182
 
183
+ This means that you have set wrong **Channel ID**. Fix that in **General** plugin settings, Widget and/or shortcode.
184
 
185
+ `<!-- YTC ERROR:
186
+ domain: usageLimits
187
+ reason: keyInvalid
188
+ message: Bad Request
189
+ -->`
190
 
191
+ If you followed [Installation](https://wordpress.org/plugins/youtube-channel/installation/) instructions, double check **YOUTUBE_DATA_API_KEY** in **wp-config.php** file. Do you have correct key generated by you and allowed to be used on your server/website?
192
 
193
+ `<!-- YTC ERROR:
194
+ domain: usageLimits
195
+ reason: ipRefererBlocked
196
+ message: There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.
197
+ -->`
198
+
199
+ Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
200
+ If that does not help, please try to create new API Key for Browser w/o restrictions (not to regenerate existing one).
201
+ We still strugling with that Google's restrictions. If you get final solution, please inform us asap.
202
+
203
+ = Where to find correct Channel ID and/or Vanity custom Name? =
204
 
205
+ Login to your YouTube account and visit page [Account Advanced](https://www.youtube.com/account_advanced).
206
 
207
+ You'll find your **Vanity Name** as "Your custom URL" in **Channel settins** section on that page. For YTC plugin use only part **after www.youtube.com/c/**, not full URL.
 
208
 
209
+ **Channel ID** is **YouTube Channel ID** value composed of mixed characters starting with **UC**.
210
 
211
+ = What is Vanity custom URL? =
212
 
213
+ Check out [Channel custom URL](https://support.google.com/youtube/answer/2657968?ref_topic=3024172&hl=en-GB) article.
214
 
 
215
 
216
+ = Where to find Playlist ID? =
217
 
218
+ Playlist ID can be manualy extracted from YouTube playlist URL. Part of strings after `&list=` that begins with uppercase letters **PL** represent Playlist ID (not full URL).
219
+
220
+ = How to force embeding 320p video with better audio quality? =
221
+
222
+ YouTube provide 320p videos if height of embeded video is set to 320 or more. If you use small YTC video size, 240p will be loaded instead. So, you could not force 720p in tiny YTC.
223
 
224
  = I enabled option `Hide YT Logo` but YouTube logo is still visible =
225
 
227
 
228
  Also, even when hidding logo works for your video, on hover or when video is paused in upper right corner will be displayed YouTube link/logo. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
229
 
230
+ = How I can achieve 'wall' layout with one featured thumbnail? =
231
 
232
  You can try with shortcode combination:
233
  `[youtube_channel num=7 responsive=1 class=ytc_wall_1-6 resource=2 random=1]`
234
 
235
  and custom CSS code added to theme style.css or similar customization:
236
  `.youtube_channel.ytc_wall_1-6 .ytc_video_container {
237
+ padding: 5px;
238
+ box-sizing: border-box;
239
  }
240
  .youtube_channel.ytc_wall_1-6 .ytc_video_container:not(:first-child) {
241
  max-width: 33.333%;
255
 
256
  == Changelog ==
257
 
258
+ = 3.0.4 (2015-05-11) =
259
+ * Add: Tip what to do if error ocurred with YouTube Data API Key printed inside YTC ERROR comment
260
+ * Change: Where to ask for support links in widget
261
+ * Change: Timeout for getting feed increased from 2 to 5 seconds
262
+ * Change: Update FAQ sections in readme file
263
+ * Remove: Check for Redux Framework in debug JSON generator
264
+
265
  = 3.0.3 (2015-05-10) =
266
  * Fix: "Ups, something went wrong." when Playlist selected as resource because wrong switch
267
  * Fix: Jumping thumbnails in responsive wall on hover in Twenty Fifteen theme because border-bottom for anchors
youtube-channel.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail or iframe (HTML5) video from YouTube Channel, Liked Videos, Favourites or Playlist.
6
  Author: Aleksandar Urošević
7
- Version: 3.0.3
8
  Author URI: http://urosevic.net/
9
  */
10
  // @TODO make FitVideo optional
@@ -18,7 +18,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
18
  {
19
 
20
  const DB_VER = 3;
21
- const VER = '3.0.3';
22
 
23
  public $plugin_name = "YouTube Channel";
24
  public $plugin_slug = "youtube-channel";
@@ -634,6 +634,15 @@ function ytc_mute(event){
634
  $output[] = 'domain: ' . $json_output->error->errors[0]->domain . "\n";
635
  $output[] = 'reason: ' . $json_output->error->errors[0]->reason . "\n";
636
  $output[] = 'message: ' . $json_output->error->errors[0]->message . "\n";
 
 
 
 
 
 
 
 
 
637
  $output[] = "-->\n";
638
  }
639
  }
@@ -722,7 +731,7 @@ function ytc_mute(event){
722
  $feed_url .= "&key=" . YOUTUBE_DATA_API_KEY;
723
 
724
  $wprga = array(
725
- 'timeout' => 2 // two seconds only
726
  );
727
  $response = wp_remote_get($feed_url, $wprga);
728
  $json = wp_remote_retrieve_body( $response );
@@ -1137,9 +1146,6 @@ JS;
1137
  {
1138
  global $wp_version;
1139
 
1140
- // get Redux Framework version (if active)
1141
- $redux = ( class_exists( "ReduxFramework" ) ) ? ReduxFramework::$_version : 'N/A';
1142
-
1143
  // get widget ID from parameter
1144
  $for = $_GET['ytc_debug_json_for'];
1145
 
@@ -1173,7 +1179,7 @@ JS;
1173
  echo json_encode($data);
1174
 
1175
  // destroy vars
1176
- unset($data,$widget_options,$widget_id,$option_name,$for,$redux);
1177
 
1178
  // exit now, because we need only debug data in JSON file, not settings or any other page
1179
  exit;
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail or iframe (HTML5) video from YouTube Channel, Liked Videos, Favourites or Playlist.
6
  Author: Aleksandar Urošević
7
+ Version: 3.0.4
8
  Author URI: http://urosevic.net/
9
  */
10
  // @TODO make FitVideo optional
18
  {
19
 
20
  const DB_VER = 3;
21
+ const VER = '3.0.4';
22
 
23
  public $plugin_name = "YouTube Channel";
24
  public $plugin_slug = "youtube-channel";
634
  $output[] = 'domain: ' . $json_output->error->errors[0]->domain . "\n";
635
  $output[] = 'reason: ' . $json_output->error->errors[0]->reason . "\n";
636
  $output[] = 'message: ' . $json_output->error->errors[0]->message . "\n";
637
+ if ( $json_output->error->errors[0]->reason == 'invalidChannelId' ) {
638
+ $output[] = "tip: You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Check https://wordpress.org/plugins/youtube-channel/faq/\n";
639
+ }
640
+ if ( $json_output->error->errors[0]->reason == 'keyInvalid' ) {
641
+ $output[] = "tip: Double check YOUTUBE_DATA_API_KEY and make sure it`s correct. Check https://wordpress.org/plugins/youtube-channel/installation/\n";
642
+ }
643
+ if ( $json_output->error->errors[0]->reason == 'ipRefererBlocked' ) {
644
+ $output[] = "tip: Check YouTube Data API Key restrictions and key in wp-config.php, empty cache if enabled and append in browser address bar parameter ?ytc_force_recache=1\n";
645
+ }
646
  $output[] = "-->\n";
647
  }
648
  }
731
  $feed_url .= "&key=" . YOUTUBE_DATA_API_KEY;
732
 
733
  $wprga = array(
734
+ 'timeout' => 5 // five seconds only
735
  );
736
  $response = wp_remote_get($feed_url, $wprga);
737
  $json = wp_remote_retrieve_body( $response );
1146
  {
1147
  global $wp_version;
1148
 
 
 
 
1149
  // get widget ID from parameter
1150
  $for = $_GET['ytc_debug_json_for'];
1151
 
1179
  echo json_encode($data);
1180
 
1181
  // destroy vars
1182
+ unset($data,$widget_options,$widget_id,$option_name,$for);
1183
 
1184
  // exit now, because we need only debug data in JSON file, not settings or any other page
1185
  exit;