Title: Customize
Last modified: July 12, 2017

---

# Customize

 *  Resolved [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/)
 * Hello!
    I have two questions. How I can add to any channel tags and author? How
   I can add to post text for example I need spoiler in description? ( [spoiler]
   post description[/spoiler] )

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/customize-41/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/customize-41/page/2/?output_format=md)

 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9360757)
 * > How I can add to any channel tags and author?
 * Can you be a little more specific here?
 * Do you mean you want to “auto-assign” some pre-determined tags and a specific
   author for each new video that comes in from a specific channel?
 * > How I can add to post text for example I need spoiler in description?
 * You can use the [`wp_insert_post_data` filter](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_insert_post_data)
   for this, but it might be a bit tricky to isolate just those posts you want. 
   Here’s an example…
 *     ```
       add_filter( 'wp_insert_post_data' , 'add_spoilers' , '99', 2 );
   
       function filter_post_data( $data , $postarr ) {
           $data['post_content'] = '[spoiler]' . $data['post_content'] . '[/spoiler]';
           return $data;
       }
       ```
   
 * Or, better yet, I’ve added a new filter which will go live with the next push.
   In the meantime, you can replace the content of “tube-video-curator.php” with
   this… [https://pastebin.com/Qpeu8eBk](https://pastebin.com/Qpeu8eBk)
 * Then, you can drop this in a functions file…
 *     ```
       add_filter( 'tube_vc_filter_post_pre_insert' , 'add_spoilers' );
   
       function add_spoilers( $my_post ) {
           $my_post['post_content'] = '[spoiler]' . $my_post['post_content'] . '[/spoiler]';
           return $data;
       }
       ```
   
 * Please give this a shot and follow up on the first question.
 * And sorry for the slow reply.
    -  This reply was modified 8 years, 10 months ago by [tubegtld](https://wordpress.org/support/users/tubegtld/).
    -  This reply was modified 8 years, 10 months ago by [tubegtld](https://wordpress.org/support/users/tubegtld/).
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9361806)
 * Hello! Thank you!
 * > Do you mean you want to “auto-assign” some pre-determined tags and a specific
   > author for each new video that comes in from a specific channel?
 * Yes.
    Or Tube_video_creator_name as post author.
 * > Or, better yet, I’ve added a new filter which will go live with the next push.
   > In the meantime, you can replace the content of “tube-video-curator.php” with
   > this… [https://pastebin.com/Qpeu8eBk](https://pastebin.com/Qpeu8eBk)
 * I replaced
 * > Then, you can drop this in a functions file…
   > add_filter( ‘tube_vc_filter_post_pre_insert’ , ‘add_spoilers’ );
   > function add_spoilers( $my_post ) {
   >  $my_post[‘post_content’] = ‘[spoiler]’.
   > $my_post[‘post_content’] . ‘[/spoiler]’; return $data; }
 * In functions.php?
    I added in functions.php, but It don’t work 🙁
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9363760)
 * Okay, added some new filters, and enhanced the new `tube_vc_filter_post_pre_insert`
   filter to include the source and channel for the video.
 * Pushing an update to WordPress shortly so please look for version 1.1.6 which
   will include these new filters.
 * Below is some code to get you started.
 *     ```
       add_filter( 'tube_vc_filter_post_pre_insert' , 'my_custom_tube_import_post', 10, 3 );
   
       function my_custom_tube_import_post( $my_post, $source_site, $creator_name ) {
   
         $my_post['post_content'] = '[spoiler]' . $my_post['post_content'] . '[/spoiler]';
   
         $my_post['post_author'] = 6;
   
         return $my_post;
   
       }
   
       add_filter( 'tube_vc_filter_import_term' , 'my_custom_tube_import_terms', 10, 3 );
   
       function my_custom_tube_import_terms( $default_term, $source_site, $creator_name ) {
   
         $my_terms = array( 9, 34, 50, 72 ); // McMahon, Paton, Singletary, Perry
   
         return $my_terms;
   
       }
       ```
   
 * A few notes…
 * 1) The `post_author` expects an author ID, so you’ll need a mechanism (e.g. User
   Meta) to associate the channel with the author.
 * I’d suggest something like SITENAME-CHANNELNAME as the value for this usermeta.
   So for example, for [this channel](https://www.youtube.com/h3h3productions) you
   might set a user mata key called `user_channel_slug` with the value “youtube-
   h3h3productions” which you could then use to find the correct user inside the
   filter like this (not tested):
 *     ```
       $users = get_users( 
         array( 
           'meta_key' => 'user_channel_slug', 
           'meta_value' => sanitize_title( $source_site . ' ' $creator_name ), 
         ) 
       )
   
       if ( $users ):
         $my_post['post_author'] = $users[0]->ID;
       ```
   
 * endif;`
 * 2) I’ve not tested this either, but the terms `tube_vc_filter_import_term` should
   also accept either (a) a single term ID, (b) a single term slug, or (c) an array
   of terms slugs as a return value.
 * Here again you can test on the `$source_site` and `$creator_name` to decide which
   term(s) to associate with the post.
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9363816)
 * BAH, won’t let me edit and there’s a bit of a mistake in formatting above where
   the endif got outside the code block.
 * Fix here…
 *     ```
       $users = get_users( 
         array( 
           'meta_key' => 'user_channel_slug', 
           'meta_value' => sanitize_title( $source_site . ' ' $creator_name ), 
         ) 
       )
   
       if ( $users ):
         $my_post['post_author'] = $users[0]->ID;
       endif;
       ```
   
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9364185)
 * Hello! Spoiler is working! Thank you very much!
 * But author don’t work 🙁
 * Parse error: syntax error, unexpected ‘$creator_name’ (T_VARIABLE), expecting‘,’
   or ‘)’ in /var/www/u0247738/data/www/youpolitics.ru/wp-content/themes/xcel/functions.
   php on line 439
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9364269)
 * My only guess is that you’re trying to use the snippet from my last comment outside
   of the filter function from the previous comment.
 * The whole thing would look like this…
 *     ```
       add_filter( 'tube_vc_filter_post_pre_insert' , 'my_custom_tube_import_post', 10, 3 );
   
       function my_custom_tube_import_post( $my_post, $source_site, $creator_name ) {
   
         $my_post['post_content'] = '[spoiler]' . $my_post['post_content'] . '[/spoiler]';
   
         $users = get_users( 
           array( 
             'meta_key' => 'user_channel_slug', 
             'meta_value' => sanitize_title( $source_site . ' ' $creator_name ), 
           ) 
         )
   
         if ( $users ):
           $my_post['post_author'] = $users[0]->ID;
         endif;
   
         return $my_post;
   
       }
       ```
   
 * Hope that helps. If not, please post the entire relevant snippet from your functions.
   php file.
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9364806)
 * Parse error: syntax error, unexpected ‘$creator_name’ (T_VARIABLE), expecting‘,’
   or ‘)’ in /var/www/u0247738/data/www/youpolitics.ru/wp-content/themes/xcel/functions.
   php on line 423
 * 🙁
 * >  add_filter( ‘tube_vc_filter_post_pre_insert’ , ‘my_custom_tube_import_post’,
   > 10, 3 );
   > function my_custom_tube_import_post( $my_post, $source_site, $creator_name ){
   >  $my_post[‘post_content’] = ‘[spoiler]’ . $my_post[‘post_content’] . ‘[/spoiler]’;
   >  $users = get_users(
   >  array( ‘meta_key’ => ‘user_channel_slug’, ‘meta_value’
   > => sanitize_title( $source_site . ‘ ‘ $creator_name ), ) )
   >  if ( $users ):
   >  $my_post[‘post_author’] = $users[0]->ID; endif;
   >  return $my_post;
   > }
   > add_filter( ‘tube_vc_filter_import_term’ , ‘my_custom_tube_import_terms’, 10,
   > 3 );
   > function my_custom_tube_import_terms( $default_term, $source_site, $creator_name){
   >  $my_terms = array( 9, 34, 50, 72 ); // McMahon, Paton, Singletary, Perry
   >  return $my_terms;
   > }
 * [https://drive.google.com/file/d/0BzoaSvJgni2HTHFzRUROSTNzNm8/view?usp=sharing](https://drive.google.com/file/d/0BzoaSvJgni2HTHFzRUROSTNzNm8/view?usp=sharing)
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9364842)
 * Missing a dot. Fix below.
 *     ```
         $users = get_users( 
           array( 
             'meta_key' => 'user_channel_slug', 
             'meta_value' => sanitize_title( $source_site . ' ' . $creator_name ), 
           ) 
         )
       ```
   
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9365078)
 * > Missing a dot. Fix below.
 * Parse error: syntax error, unexpected ‘if’ (T_IF) in /var/www/u0247738/data/www/
   youpolitics.ru/wp-content/themes/xcel/functions.php on line 427
 * now 🙁
 * line 427: if ( $users ):
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9370546)
 * Now missing a semi-colon. Complete snippet with fixes below.
 *     ```
       add_filter( 'tube_vc_filter_post_pre_insert' , 'my_custom_tube_import_post', 10, 3 );
   
       function my_custom_tube_import_post( $my_post, $source_site, $creator_name ) {
   
         $my_post['post_content'] = '[spoiler]' . $my_post['post_content'] . '[/spoiler]';
   
         $users = get_users(
           array(
             'meta_key' => 'user_channel_slug',
             'meta_value' => sanitize_title( $source_site . ' ' . $creator_name ),
           )
         );
   
         if ( $users ):
           $my_post['post_author'] = $users[0]->ID;
         endif;
   
         return $my_post;
   
       }
   
       add_filter( 'tube_vc_filter_import_term' , 'my_custom_tube_import_terms', 10, 3 );
   
       function my_custom_tube_import_terms( $default_term, $source_site, $creator_name ) {
   
         $my_terms = array( 9, 34, 50, 72 ); // McMahon, Paton, Singletary, Perry
   
         return $my_terms;
   
       }
       ```
   
    -  This reply was modified 8 years, 10 months ago by [tubegtld](https://wordpress.org/support/users/tubegtld/).
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9395695)
 * Ok, now I have not errors, but author do not add.
 * for example
 * channel [https://www.youtube.com/channel/UCvh7M2BvWW1cabkELmIYUAQ/featured](https://www.youtube.com/channel/UCvh7M2BvWW1cabkELmIYUAQ/featured)
 * [http://imagestun.com/hosting/?v=slugvjv.jpg](http://imagestun.com/hosting/?v=slugvjv.jpg)
 * Is it correct?
    -  This reply was modified 8 years, 10 months ago by [dreyg9](https://wordpress.org/support/users/dreyg9/).
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9395801)
 * The `user_channel_slug` for this author should be `youtube-oleg-neretin`
    -  This reply was modified 8 years, 10 months ago by [tubegtld](https://wordpress.org/support/users/tubegtld/).
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9398079)
 * Don’t work :(((
 * Author add as Default Author 🙁
 *  Plugin Author [tubegtld](https://wordpress.org/support/users/tubegtld/)
 * (@tubegtld)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9398518)
 * The code above is tested and working in our development environment, so sorry
   to say but there must be something amiss on your end.
 * 1) Be sure you’ve added the complete code snippet above to your active child 
   theme’s function.php or a plugin that’s been activated.
 * 2) Be sure that you’ve added USER meta for the author in question that has a 
   key of `user_channel_slug` and a value of the source site and channel name after
   a `sanitize_title` filter.
 * Steps to test…
 * 1) Create a new user with any name and at least “author” credentials, and make
   note of the user_id
 * 2) Run this code snippet…
 * `update_user_meta( 2, 'user_channel_slug', 'youtube-mama-natural');`
 * IMPORTANT: Be sure to replace `2` with the user_id for the new user
 * 3) Go to the plugin settings page for “Add Channels & Playlists”
 * 4) Search for “Mama Natural”, then find and “Save” the channel with 230,000+ 
   subscribers (pic of brunette woman holding a baby)
 * 5) Go to “Find Videos” for that channel
 * 6) Publish a video, then click the “edit” link
 * 7) Confirm that the author is properly set to the user with the id matching the
   ID from steps 1 and 2 above
 * As this is tested and working in our dev setup, and we’ve provided complete sample
   code, at this point we won’t be able to provide further free support for this
   ticket.
 *  Thread Starter [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * (@dreyg9)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/customize-41/#post-9399694)
 * It works :)))
 * Thank you,
    thank you, thank you very much!
 * 5 stars!
    -  This reply was modified 8 years, 10 months ago by [dreyg9](https://wordpress.org/support/users/dreyg9/).

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/customize-41/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/customize-41/page/2/?output_format=md)

The topic ‘Customize’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/tube-video-curator_cad3cd.svg)
 * [.TUBE Video Curator](https://wordpress.org/plugins/tube-video-curator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tube-video-curator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tube-video-curator/)
 * [Active Topics](https://wordpress.org/support/plugin/tube-video-curator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tube-video-curator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tube-video-curator/reviews/)

## Tags

 * [filter content](https://wordpress.org/support/topic-tag/filter-content/)

 * 17 replies
 * 2 participants
 * Last reply from: [dreyg9](https://wordpress.org/support/users/dreyg9/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/customize-41/page/2/#post-9400979)
 * Status: resolved