Merge lp:~caleb-ellis/resource-centre/remove-youtube-metabox into lp:resource-centre

Proposed by Caleb Ellis
Status: Merged
Approved by: Anthony Dillon
Approved revision: 107
Merged at revision: 106
Proposed branch: lp:~caleb-ellis/resource-centre/remove-youtube-metabox
Merge into: lp:resource-centre
Diff against target: 159 lines (+21/-46)
1 file modified
functions/metaboxes.php (+21/-46)
To merge this branch: bzr merge lp:~caleb-ellis/resource-centre/remove-youtube-metabox
Reviewer Review Type Date Requested Status
Anthony Dillon Approve
Review via email: mp+337775@code.launchpad.net

Description of the change

Removed YouTube metabox from insights admin page

To post a comment you must log in.
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Looks good thanks.

I have installed the change on insights.canonicalwebteam.com and the video metabox is not there in the admin.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'functions/metaboxes.php'
2--- functions/metaboxes.php 2017-10-16 15:09:37 +0000
3+++ functions/metaboxes.php 2018-02-15 12:29:47 +0000
4@@ -3,19 +3,19 @@
5 define('WYSIWYG_META_BOX_ID', 'dbt_press_links');
6 define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
7 define('WYSIWYG_META_KEY', 'dbt_press_links');
8-
9+
10 add_action('admin_init', 'wysiwyg_register_meta_box');
11 function wysiwyg_register_meta_box(){
12 add_meta_box(WYSIWYG_META_BOX_ID, __('Press release links', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
13 }
14-
15+
16 function wysiwyg_render_meta_box(){
17-
18+
19 global $post;
20-
21+
22 $meta_box_id = WYSIWYG_META_BOX_ID;
23 $editor_id = WYSIWYG_EDITOR_ID;
24-
25+
26 echo "<p>Add press release links here using the 'insert link' tool on the toolbar (new line for each link)</p>";
27 //Add CSS & jQuery goodness to make this work like the original WYSIWYG
28 echo "
29@@ -25,26 +25,26 @@
30 #$meta_box_id #editorcontainer{background:#fff !important;}
31 #$meta_box_id #$editor_id_fullscreen{display:none;}
32 </style>
33-
34+
35 <script type='text/javascript'>
36 jQuery(function($){
37 $('#$meta_box_id #editor-toolbar > a').click(function(){
38 $('#$meta_box_id #editor-toolbar > a').removeClass('active');
39 $(this).addClass('active');
40 });
41-
42+
43 if($('#$meta_box_id #edButtonPreview').hasClass('active')){
44 $('#$meta_box_id #ed_toolbar').hide();
45 }
46-
47+
48 $('#$meta_box_id #edButtonPreview').click(function(){
49 $('#$meta_box_id #ed_toolbar').hide();
50 });
51-
52+
53 $('#$meta_box_id #edButtonHTML').click(function(){
54 $('#$meta_box_id #ed_toolbar').show();
55 });
56-
57+
58 //Tell the uploader to insert content into the correct WYSIWYG editor
59 $('#media-buttons a').bind('click', function(){
60 var customEditor = $(this).parents('#$meta_box_id');
61@@ -58,24 +58,24 @@
62 });
63 </script>
64 ";
65-
66+
67 //Create The Editor
68 $content = get_post_meta($post->ID, WYSIWYG_META_KEY, true);
69 wp_editor($content, $editor_id);
70-
71+
72 //Clear The Room!
73 echo "<div style='clear:both; display:block;'></div>";
74 }
75-
76+
77 add_action('save_post', 'wysiwyg_save_meta');
78 function wysiwyg_save_meta(){
79-
80+
81 $editor_id = WYSIWYG_EDITOR_ID;
82 $meta_key = WYSIWYG_META_KEY;
83-
84+
85 if(isset($_REQUEST[$editor_id]))
86 update_post_meta($_REQUEST['post_ID'], WYSIWYG_META_KEY, $_REQUEST[$editor_id]);
87-
88+
89 }
90
91 add_filter( 'dbt_press_contact', 'make_clickable', 9 );
92@@ -122,8 +122,8 @@
93 //'type' => 'text'
94 //)
95 )
96-);
97-
98+);
99+
100 add_action('admin_menu', 'mytheme_add_box');
101
102 // Add meta box
103@@ -152,7 +152,7 @@
104 '<th style="width:20%"><label for="', $field['id'], '">', $field['name'], '</label></th>',
105 '<td>';
106 switch ($field['type']) {
107-
108+
109 case 'checkbox':
110 echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
111 break;
112@@ -207,31 +207,6 @@
113 }
114 }
115
116-// add youtube metabox
117-add_action('admin_menu', 'insights_meta_boxes');
118-function insights_meta_boxes() {
119- if ( function_exists('add_meta_box') ) {
120- add_meta_box('post_id', 'YouTube', 'custom_post_video', 'post', 'normal', 'high');
121- //add_meta_box('post_id', 'YouTube', 'custom_post_video', 'video', 'normal', 'high');
122- }
123-}
124-
125-//Adds the youtube box in admin
126-function custom_post_video() {
127- global $post;
128- ?>
129- <div class="inside">
130- <p>
131- <label for="postVideo">Code</label>
132- <input type="text" name="postVideo" id="postVideo" value="<?php echo get_post_meta($post->ID, 'postVideo', true); ?>">
133- </p>
134- <p>Enter the YouTube video 11 digit code here e.g from this url http://www.youtube.com/watch?v=D6z6hn6wZlg you need the 11 digits after ?v= i.e <strong>D6z6hn6wZlg</strong></p>
135-
136- <p>Enter the codes comma separated (no space) if you have more than one e.g: <strong>h384z7Ph0gU,5_4fXQcxFRs</strong></p>
137- </div>
138-<?php
139-}
140-
141 add_action('save_post', 'custom_add_save');
142
143 function custom_add_save($postID){
144@@ -245,7 +220,7 @@
145 {
146 $postID = $parent_id;
147 }
148- if ($_POST['postVideo'])
149+ if ($_POST['postVideo'])
150 {
151 update_custom_meta($postID, $_POST['postVideo'], 'postVideo');
152 }
153@@ -266,4 +241,4 @@
154 }
155 }
156
157-?>
158\ No newline at end of file
159+?>

Subscribers

People subscribed via source and target branches