PluginProbe
wpForo Forum / 2.2.9
wpForo Forum v2.2.9
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / admin / pages / forum.php

forum.php in wpForo Forum 2.2.9, at admin/pages/forum.php

519 lines 34.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( ! defined( 'ABSPATH' ) ) exit;
4 if( ! WPF()->usergroup->can_manage_forum() ) exit;
5
6 $action = wpfval( $_GET, 'action' );
7 ?>
8
9 <!-- Screen Options -->
10 <?php if( in_array( $action, [ 'add', 'edit' ] ) ) : ?>
11
12 <div id="screen-meta" class="metabox-prefs" style="display: none; ">
13 <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="Screen Options Tab" style="display: none; ">
14 <form id="adv-settings" action="" method="POST">
15 <h5><?php _e( 'Show on screen', 'wpforo' ); ?></h5>
16 <div class="metabox-prefs">
17 <label for="forum_cat-hide"><input class="hide-postbox-tog" name="forum_cat-hide" type="checkbox" id="forum_cat-hide" value="forum_cat" checked="checked"><?php _e( 'Forum Options', 'wpforo' ); ?></label>
18 <label for="forum_permissions-hide"><input class="hide-postbox-tog" name="forum_permissions-hide" type="checkbox" id="forum_permissions-hide" value="forum_permissions" checked="checked"><?php _e( 'Permissions', 'wpforo' ); ?></label>
19 <label for="forum_slug-hide"><input class="hide-postbox-tog" name="forum_slug-hide" type="checkbox" id="forum_slug-hide" value="forum_slug" checked="checked"><?php _e( 'Slug', 'wpforo' ); ?></label>
20 <label for="forum_meta-hide"><input class="hide-postbox-tog" name="forum_meta-hide" type="checkbox" id="forum_meta-hide" value="forum_meta" checked="checked"><?php _e( 'Forum Meta', 'wpforo' ); ?></label>
21 <br class="clear">
22 </div>
23 <h5 class="screen-layout"><?php _e( 'Screen Layout', 'wpforo' ); ?></h5>
24 <div class="columns-prefs"><?php _e( 'Number of Columns', 'wpforo' ); ?>:
25 <label class="columns-prefs-1"><input type="radio" name="screen_columns" value="1">1</label>
26 <label class="columns-prefs-2"><input type="radio" name="screen_columns" value="2" checked="checked">2</label>
27 </div>
28 </form>
29 </div>
30 </div>
31
32 <div id="screen-meta-links">
33 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle" style="">
34 <button aria-expanded="true" aria-controls="screen-options-wrap" class="button show-settings screen-meta-active" id="show-settings-link" type="button"><?php _e( 'Screen Options', 'wpforo' ); ?></button>
35 </div>
36 </div>
37
38 <?php endif; ?>
39 <!-- end Screen Options -->
40
41 <div id="icon-edit" class="icon32 icon32-posts-post"></div>
42 <div id="wpf-admin-wrap" class="wrap">
43
44 <h2 style="padding:30px 0 10px; line-height: 20px;">
45 <?php _e( 'Categories and Forums', 'wpforo' ); ?> &nbsp;
46 <a href="<?php echo admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'forums' ) . '&action=add' ) ?>" class="add-new-h2"><?php _e( 'Add New', 'wpforo' ); ?></a>
47 </h2>
48
49 <?php WPF()->notice->show() ?>
50
51 <!-- Forum Hierarchy -->
52 <?php if( ! $action ) : ?>
53 <?php if( WPF()->usergroup->can_manage_forum() ): ?>
54
55 <div class="wpf-info-bar" style="line-height: 1em; clear:both; padding: 5px 50px; box-sizing: border-box; font-size:15px; display:block; box-shadow:none; margin: 20px 0 10px 0; font-style: italic; background: #FFFFFF; width:100%; position: relative;">
56 <a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-manager/" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 16px; position: absolute; right: 15px; top: 15px;"><i class="far fa-question-circle"></i></a>
57 <ul style="list-style-type: disc; line-height:18px;">
58 <li style="list-style:none; margin-left:-17px; font-style:normal; font-weight:bold; padding-bottom: 5px;"><i class="fas fa-info-circle" aria-hidden="true"></i>&nbsp; <?php _e( 'Important Tips', 'wpforo' ); ?></li>
59 <li><?php _e( 'Please drag and drop forum panels to set parent-child hierarchy.', 'wpforo' ); ?></li>
60 <li><?php _e( 'If a category (blue panels) does not have forums (grey panels) it will not be displayed on front-end. Each category should contain at least one forum.', 'wpforo' ); ?></li>
61 <li><?php _e( 'Forums can be displayed with different layouts (Extended, Simplified, Q&A, Threaded), just edit the top (blue panels) category and set the layout you want. Child forums\' layout depends on the top category (blue panels) layout. They cannot have a different layout.', 'wpforo' ); ?></li>
62 </ul>
63 </div>
64 <br style="clear: both;"/>
65
66 <form id="forum-hierarchy" encType="multipart/form-data" method="POST">
67 <?php wp_nonce_field( 'wpforo-forums-hierarchy' ); ?>
68 <input type="hidden" name="wpfaction" value="forum_hierarchy_save">
69 <div id="post-body">
70 <ul id="menu-to-edit" class="menu">
71
72 <?php WPF()->forum->tree( 'drag_menu' ); ?>
73
74 </ul>
75 </div>
76 <br/>
77 <div class="major-publishing-actions">
78 <div class="publishing-action"><input id="save_menu_footer" class="button button-primary menu-save" name="save_menu" value="<?php _e( 'Save forums order and hierarchy', 'wpforo' ); ?>" onclick="get_forums_hierarchy()" type="button"></div>
79 </div>
80 </form>
81 <?php endif; ?><!--checking edit forum permission-->
82 <?php endif; ?>
83 <!-- end Forum Hierarchy -->
84 <br style="clear: both;"/>
85 <!-- Forum Add || Edit -->
86 <?php if( in_array( $action, [ 'add', 'edit' ] ) ) : ?>
87 <?php if( WPF()->usergroup->can_manage_forum() ): ?>
88 <?php
89 $data = [];
90 $disabled_forumid = 0;
91 $selected_forumid = 0;
92 if( ! empty( $_GET['id'] ) ) {
93 $disabled_forumid = [ $_GET['id'] ];
94 if( $data = WPF()->forum->get_forum( [ 'forumid' => $_GET['id'] ] ) ) $selected_forumid = $data['parentid'];
95 }
96 if( ! empty( $_GET['parentid'] ) ) $selected_forumid = $_GET['parentid'];
97 $color = wpfval( $data, 'color' ) ? $data['color'] : wpforo_random_colors();
98 ?>
99 <style type="text/css">
100 #forum_layout .wpf-fl-box a:not(.wpf-lightbox) {
101 cursor: zoom-in;
102 display: inline-block;
103 }
104
105 .wpf-lightbox {
106 display: none;
107 cursor: zoom-out;
108 position: fixed;
109 z-index: 999;
110 width: 100%;
111 height: 100%;
112 text-align: center;
113 top: 0;
114 left: 0;
115 background: rgba(0, 0, 0, 0.8);
116 }
117
118 .wpf-lightbox img {
119 max-width: 90%;
120 max-height: 90%;
121 margin-top: 3%;
122 }
123
124 .wpf-lightbox:target {
125 outline: none;
126 display: block;
127 }
128
129 .wpf-fl-wrap {
130 display: flex;
131 flex-wrap: wrap;
132 flex-direction: row;
133 justify-content: space-evenly;
134 align-items: stretch;
135 }
136
137 .wpf-fl-box {
138 margin: 6px;
139 border: 1px solid #cccccc;
140 padding: 5px;
141 text-align: center;
142 }
143
144 .wpf-fl-box h4 {
145 cursor: pointer;
146 text-align: center;
147 margin: 1px;
148 font-size: 14px;
149 background: #bbbbbb;
150 color: #ffffff;
151 padding: 2px 1px 4px 1px;
152 }
153
154 .wpf-fl-box.wpf-fl-active {
155 border-color: #128403;
156 }
157
158 .wpf-fl-box.wpf-fl-active h4 {
159 background-color: #128403;
160 }
161 </style>
162 <script type="text/javascript">
163 if (typeof wpforo_setAttr !== 'function') {
164 // The function exists
165 /**
166 *
167 * @param { jQuery|Element|Document } element
168 * @param { string } name
169 * @param { string|number|integer } value
170 */
171 function wpforo_setAttr( element, name, value ){
172 if( element instanceof jQuery || element instanceof Element ){
173 element = jQuery( element );
174 element.prop( name, value );
175 element.attr( name, value );
176
177 var match = name.match( new RegExp('^data-(.+)', 'i') );
178 if( match ) element.data( match[1], value );
179 }
180 }
181 }
182
183 jQuery(document).ready(function ($) {
184 $('.wpforo-color-field').wpColorPicker()
185
186 $('#forum_layout').on('click', '.wpf-fl-box:not(.wpf-fl-active) h4', function () {
187 if ($('#use_us_cat').is(':checked')) {
188 var wrap = $(this).parents('.wpf-fl-box')
189 if (wrap) {
190 var layout = wrap.data('layout')
191 if (layout) {
192 const opt = $('#layout option[value="' + layout + '"]');
193 wpforo_setAttr( opt, 'selected', true );
194 // $('#layout option[value="' + layout + '"]').attr('selected', true)
195 $('.wpf-fl-box').removeClass('wpf-fl-active')
196 wrap.addClass('wpf-fl-active')
197 }
198 }
199 }
200 })
201 $('#layout').on('change', function () {
202 $('.wpf-fl-box').removeClass('wpf-fl-active')
203 $('#wpfl-' + this.value).addClass('wpf-fl-active')
204 })
205 $('#use_us_cat').on('change', function () {
206 if( !$(this).is(':checked') ) {
207 $( '#wpf_forum_cover_field' ).hide();
208 <?php if( wpfkey( $data, 'is_cat' ) && ! wpfval( $data, 'is_cat' ) ): ?>
209 $('.wpf-fl-box').removeClass('wpf-fl-active')
210 var wpf_layout = $('#wpf-current-layout').val()
211 $('#wpfl-' + wpf_layout).addClass('wpf-fl-active')
212 <?php else: ?>
213 $('.wpf-fl-box').removeClass('wpf-fl-active')
214 $('#forum_layout').hide()
215 <?php endif; ?>
216 } else {
217 $( '#wpf_forum_cover_field' ).show();
218 $('.wpf-fl-box').removeClass('wpf-fl-active')
219 var wpf_layout = $('#layout').find('option:selected').val()
220 $('#wpfl-' + wpf_layout).addClass('wpf-fl-active')
221 $('#forum_layout').show()
222 }
223 })
224 })
225 </script>
226 <div id="poststuff">
227 <form name="forum" method="POST">
228 <?php if( $action === 'add' ) : ?>
229 <?php wp_nonce_field( 'wpforo-forum-add' ); ?>
230 <input type="hidden" name="wpfaction" value="forum_add">
231 <?php elseif( $action === 'edit' ) : ?>
232 <?php wp_nonce_field( 'wpforo-forum-edit' ); ?>
233 <input type="hidden" name="wpfaction" value="forum_edit">
234 <input type="hidden" name="forum[forumid]" value="<?php echo (int) wpfval( $_GET, 'id' ) ?>">
235 <?php endif ?>
236
237 <div id="post-body" class="metabox-holder columns-2">
238 <div id="post-body-content">
239 <input type="hidden" name="wpforo_submit" value="1"/>
240 <input type="hidden" name="forum[order]" value="<?php echo esc_attr( isset( $data['order'] ) ? $data['order'] : '' ) ?>"/>
241 <div class="form-wrap">
242 <div class="form-field form-required" style="margin-bottom:0px; padding-bottom:0px;">
243 <div id="titlediv">
244 <div id="titlewrap">
245 <input id="title" name="forum[title]" type="text" value="<?php echo esc_attr( isset( $data['title'] ) ? $data['title'] : '' ) ?>" size="40" autocomplete="off" required="TRUE" placeholder="<?php _e( 'Enter forum title here', 'wpforo' ); ?>"/>
246 </div>
247 </div>
248 <p>&nbsp;</p>
249 <div class="form-field">
250 <?php
251 wp_editor( wpautop( wp_unslash( wpfval( $data, 'description' ) ) ), sanitize_title( 'forum[description]' ), [
252 'teeny' => true,
253 'media_buttons' => true,
254 'textarea_rows' => 6,
255 'tinymce' => [ 'wpautop' => false, 'setup' => 'wpforo_admin_tinymce_setup' ],
256 'quicktags' => [ 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ],
257 'default_editor' => 'tinymce',
258 'textarea_name' => 'forum[description]',
259 ] );
260 ?>
261 <p><?php _e( 'This is a forum description. This content will be displayed under forum title on the forum list.', 'wpforo' ); ?></p>
262 </div>
263 </div>
264 </div>
265 </div>
266
267 <div id="postbox-container-1" class="postbox-container">
268 <div id="side-sortables" class="meta-box-sortables ui-sortable">
269 <div id="forum_cat" class="postbox">
270 <h3 class="wpf-box-header"><span><?php _e( 'Forum Options', 'wpforo' ); ?> &nbsp;<a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-manager/add-new-forum/#forum-options" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 14px;"><i class="far fa-question-circle"></i></a></span></h3>
271 <div class="inside">
272 <div class="form-field">
273 <p><strong><?php _e( 'Parent Forum', 'wpforo' ); ?></strong></p>
274 <p>
275 <select id="parent" name="forum[parentid]" class="postform" <?php echo( isset( $data['is_cat'] ) && $data['is_cat'] == 1 ? 'disabled' : '' ) ?>>
276 <option value="0"><?php _e( 'No parent', 'wpforo' ); ?></option>
277 <?php WPF()->forum->tree( 'select_box', true, $selected_forumid, false, $disabled_forumid ); ?>
278 </select>
279 </p>
280 <p class="form-field">
281 <label for="use_us_cat"><?php _e( 'Use as Category', 'wpforo' ); ?> &nbsp;<input id="use_us_cat" onclick="document.getElementById('parent').disabled = this.checked; document.getElementById('layout').disabled = !this.checked;" type="checkbox" name="forum[is_cat]" value="1" <?php echo( isset( $data['is_cat'] ) && $data['is_cat'] == 1 ? 'checked' : '' ) ?>/> </label>
282 </p>
283 <p><strong><?php _e( 'Category Layout', 'wpforo' ); ?></strong></p>
284 <p>
285 <?php $layouts = WPF()->tpl->find_layouts(); ?>
286 <?php if( ! empty( $layouts ) ): ?>
287 <select id="layout" name="forum[layout]" class="postform" <?php $data['layout'] = ( isset( $data['layout'] ) ? $data['layout'] : 1 );
288 echo( isset( $data['is_cat'] ) && $data['is_cat'] == 1 ? '' : 'disabled="TRUE"' ); ?> >
289 <?php WPF()->tpl->show_layout_selectbox( $data['layout'] ); ?>
290 </select>
291 <?php else: ?>
292 <p><?php _e( 'No layout found.', 'wpforo' ); ?></p>
293 <?php endif; ?>
294 </p>
295 </div>
296 </div>
297 </div>
298
299 <div id="submitdiv" class="postbox">
300 <h3 class="wpf-box-header"><span><?php _e( 'Publish', 'wpforo' ); ?></span></h3>
301 <div class="inside">
302 <div id="major-publishing-actions" style="text-align:right;">
303 <?php if( $action === 'edit' ) : ?>
304 <a class="wpf-delete button" href="?page=<?php echo wpforo_prefix_slug( 'forums' ) ?>&id=<?php echo intval( wpfval($data, 'forumid') ) ?>&action=del" onclick="if (!confirm('<?php _e( 'Are you sure you want to delete this forum?', 'wpforo' ); ?>')) { return false; }"><?php _e( 'Delete', 'wpforo' ); ?></a> &nbsp;
305 <a class="preview button" href="<?php echo wpforo_home_url( ( isset( $data['slug'] ) ? $data['slug'] : '' ) ) ?>" target="wp-preview" id="post-preview" style="display:inline-block;float:none;"><?php _e( 'View', 'wpforo' ); ?></a> &nbsp;
306 <input type="submit" name="forum[save_edit]" class="button button-primary forum_submit" style="display:inline-block;float:none;" value="<?php _e( 'Update', 'wpforo' ); ?>">
307 <?php else: ?>
308 <input type="submit" name="forum[save_edit]" class="button button-primary forum_submit" style="display:inline-block;float:none;" value="<?php _e( 'Publish', 'wpforo' ); ?>">
309 <?php endif; ?>
310 <div class="clear"></div>
311 </div>
312 </div>
313 </div>
314
315
316 <div id="forum_permissions" class="postbox">
317 <h3 class="wpf-box-header"><span><?php _e( 'Forum Permissions', 'wpforo' ); ?> &nbsp;<a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-manager/add-new-forum/#forum-permissions" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 14px;"><i class="far fa-question-circle"></i></a></span></h3>
318 <div class="inside">
319 <table>
320 <?php WPF()->forum->permissions(); ?>
321 </table>
322 </div>
323 </div>
324
325 <div id="forum_color" class="postbox">
326 <h3 class="wpf-box-header"><span><?php _e( 'Additional Options', 'wpforo' ); ?> &nbsp;</span></h3>
327 <div class="inside">
328 <div class="wpf-forum-additional-options">
329 <div style="float: left; padding: 2px 10px 0 0;"><?php _e( 'Forum Color', 'wpforo' ) ?></div>
330 <div class="wpforo-style-field">
331 <input class="wpforo-color-field" name="forum[color]" type="text" value="<?php wpfo( strtoupper( (string) $color ) ); ?>" title="<?php wpfo( strtoupper( (string) $color ) ); ?>"/>
332 </div>
333 <div style="clear: both"></div>
334 </div>
335 </div>
336 </div>
337
338 <?php do_action( 'wpforo_dashboard_forum_form_side', $data ); ?>
339
340 </div>
341 </div>
342 <div id="postbox-container-2" class="postbox-container">
343 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
344
345 <div id="forum_layout" class="postbox" <?php if( ! wpfkey( $data, 'is_cat' ) ) echo 'style="display: none"'; ?>>
346 <h3 class="wpf-box-header">
347 <span>
348 <?php if( wpfkey( $data, 'is_cat' ) ): ?>
349 <?php if( wpfval( $data, 'is_cat' ) ): ?>
350 <?php _e( 'Current layout and cover image of this category', 'wpforo' ); ?>
351 <?php else: ?>
352 <?php _e( 'Current layout of this forum (inherited from parent category)', 'wpforo' ); ?>
353 <?php endif; ?>
354 <?php else: ?>
355 <?php _e( 'Category layout and cover image', 'wpforo' ); ?>
356 <?php endif; ?>
357 &nbsp;<a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-layouts/" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 14px;"><i class="far fa-question-circle"></i></a>
358 </span>
359 </h3>
360 <div class="inside" style="padding: 5px 7px;">
361 <div class="wpf-fl-wrap">
362 <input type="hidden" id="wpf-current-layout" name="wpf-current-layout" value="<?php if( wpfval( $data, 'layout' ) ) echo intval( $data['layout'] ) ?>">
363 <?php $layouts = WPF()->tpl->find_layouts(); $theme = WPF()->tpl->theme;
364 if( ! empty( $layouts ) ): foreach( $layouts as $layout ) : ?>
365 <div id="wpfl-<?php echo intval( $layout['id'] ) ?>" data-layout="<?php echo intval( $layout['id'] ) ?>" class="wpf-fl-box <?php if( wpfkey( $data, 'is_cat' ) && $layout['id'] == $data['layout'] ) echo 'wpf-fl-active' ?>">
366 <a href="#img1<?php echo intval( $layout['id'] ); ?>"><img src="<?php echo WPFORO_URL ?>/themes/<?php echo esc_attr($theme) ?>/layouts/<?php echo intval( $layout['id'] ); ?>/view-forums.png" style="height: 100px;"/></a>
367 <a href="#_" class="wpf-lightbox" id="img1<?php echo intval( $layout['id'] ); ?>"><img src="<?php echo WPFORO_URL ?>/themes/<?php echo esc_attr($theme) ?>/layouts/<?php echo intval( $layout['id'] ); ?>/view-forums.png"/></a>
368 <a href="#img2<?php echo intval( $layout['id'] ); ?>"><img src="<?php echo WPFORO_URL ?>/themes/<?php echo esc_attr($theme) ?>/layouts/<?php echo intval( $layout['id'] ); ?>/view-posts.png" style="height: 100px;"/></a>
369 <a href="#_" class="wpf-lightbox" id="img2<?php echo intval( $layout['id'] ); ?>"><img src="<?php echo WPFORO_URL ?>/themes/<?php echo esc_attr($theme) ?>/layouts/<?php echo intval( $layout['id'] ); ?>/view-posts.png"/></a>
370 <h4><?php echo esc_html( $layout['name'] ) ?><!-- <input type="radio" name="forum[layout]" value="<?php echo esc_attr( trim( (string) $layout['id'] ) ) ?>" <?php echo( $layout['id'] == $data['layout'] ? ' checked="checked" ' : '' ); ?> /> --></h4>
371 </div>
372 <?php endforeach; endif; ?>
373 </div>
374 <p style="font-style: italic; padding: 0 10px 5px; margin: 10px 0;"><i class="fas fa-info-circle" style="color: #777777; font-size: 14px; padding-right: 3px;"></i> <?php _e(
375 'Forums can be displayed with different layouts (Extended, Simplified, Q&A, Threaded). Use the "Category Layout" dropdown located on the top right section to set the layout you want. This option is only available for Categories (top parent forums). Other forums and sub-forums inherit it. They cannot have a different layout, therefore the layout dropdown option becomes disabled if this forum is not a Category.',
376 'wpforo'
377 ); ?></p>
378
379
380 <?php $show_cover_field = ! (int) wpfval($data, 'forumid') || (int) wpfval($data, 'is_cat'); ?>
381 <div id="wpf_forum_cover_field" style="padding: 10px; <?php echo ( $show_cover_field ? 'display: block' : 'display: none' ) ?>">
382 <h3 style="font-size: 15px;"><?php _e('Category Cover Image', 'wpforo') ?></h3>
383 <div id="wpf-forum-cover" style="background-image: url('<?php echo esc_url_raw( wpfval( $data, 'cover_url' ) ) ?>')">
384 <?php
385 if( wpfval( $data, 'cover_url' ) ) {
386 echo '<a href="#" id="wpf-forum-cover-upload" class="wpf-cat-cover-upl button button-secondary" style="display:none">' . __('Upload image', 'wpforo') . '</a>
387 <a href="#" id="wpf-forum-cover-remove" class="wpf-cat-cover-rmv button button-secondary">' . __('Remove image', 'wpforo') . '</a>
388 <input id="wpf-forum-cover-filed" type="hidden" name="forum[cover]" value="' . $data['cover'] . '">';
389
390 } else {
391 echo '<a href="#" id="wpf-forum-cover-upload" class="wpf-cat-cover-upl button button-secondary">' . __('Upload image', 'wpforo') . '</a>
392 <a href="#" id="wpf-forum-cover-remove" class="wpf-cat-cover-rmv button button-secondary" style="display:none">' . __('Remove image', 'wpforo') . '</a>
393 <input id="wpf-forum-cover-filed" type="hidden" name="forum[cover]" value="">';
394
395 }
396 ?>
397 </div>
398 </div>
399
400 <script>
401 jQuery(function($){
402 $('body').on( 'click', '.wpf-cat-cover-upl', function(e){
403 e.preventDefault();
404 var button = $(this),
405 custom_uploader = wp.media({
406 title: '<?php echo __('Insert image', 'wpforo') ?>',
407 library : { type : 'image' },
408 button: { text: '<?php echo __('Use this image', 'wpforo') ?>'},
409 multiple: false
410 }).on('select', function() { // it also has "open" and "close" events
411 var attachment = custom_uploader.state().get('selection').first().toJSON();
412 $('#wpf-forum-cover').css("background-image", "url(" + attachment.url + ")");
413 $('#wpf-forum-cover-filed').val(attachment.id);
414 $('#wpf-forum-cover-upload').hide();
415 $('#wpf-forum-cover-remove').show();
416 }).open();
417 });
418 $('body').on('click', '.wpf-cat-cover-rmv', function(e){
419 e.preventDefault();
420 var button = $(this);
421 $('#wpf-forum-cover-filed').val('');
422 $('#wpf-forum-cover-remove').hide();
423 $('#wpf-forum-cover-upload').show();
424 $('#wpf-forum-cover').css("background-image", "");
425 });
426 });
427 </script>
428
429 </div>
430 </div>
431
432 <div id="forum_slug" class="postbox">
433 <h3 class="wpf-box-header"><span><?php _e( 'Forum Slug', 'wpforo' ); ?> &nbsp;<a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-manager/add-new-forum/#forum-slug" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 14px;"><i class="far fa-question-circle"></i></a></span></h3>
434 <div class="inside">
435 <input name="forum[slug]" type="text" value="<?php echo esc_attr( isset( $data['slug'] ) ? $data['slug'] : '' ) ?>" size="40"/>
436 <p><?php _e( 'The "slug" is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'wpforo' ); ?> </p><br/>
437 </div>
438 </div>
439
440 <div id="forum_icon" class="postbox">
441 <h3 class="wpf-box-header"><span><?php _e( 'Forum Icon', 'wpforo' ); ?> &nbsp;<a href="https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-manager/add-new-forum/#forum-icon" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank" style="font-size: 14px;"><i class="far fa-question-circle"></i></a></span></h3>
442 <div class="inside" style="padding-top:10px;">
443 <div class="form-field">
444 <label for="tag-icon" style="display:block; padding-bottom:5px;"><?php _e( 'Font-awesome Icon', 'wpforo' ); ?>:</label>
445 <div><input name="forum[icon]" value="<?php echo ( isset( $data['icon'] ) && $data['icon'] ) ? esc_attr( $data['icon'] ) : 'fas fa-comments'; ?>" type="text"></div>
446 <p style="margin-bottom:0; margin-top:5px;"><?php _e( 'You can find all icons', 'wpforo' ); ?> <a href="http://fontawesome.io/icons/" target="_blank"><?php _e( 'here', 'wpforo' ); ?>.</a> <?php _e( 'Make sure you insert a class of font-awesome icon, it should start with fa- prefix like &quot;fas fa-comments&quot;.', '' ) ?></p>
447 </div>
448 </div>
449 </div>
450
451 <div id="forum_meta" class="postbox">
452 <h3 class="wpf-box-header"><span><?php _e( 'Forum SEO Description', 'wpforo' ); ?></span></h3>
453 <div class="inside" style="padding-top:10px;">
454 <div class="form-field">
455 <label for="tag-description" style="display:block; padding-bottom:5px;"><?php _e( 'Meta Description', 'wpforo' ); ?>:</label>
456 <textarea name="forum[meta_desc]" rows="3" cols="40"><?php echo esc_html( isset( $data['meta_desc'] ) ? $data['meta_desc'] : '' ) ?></textarea>
457 </div>
458 </div>
459 </div>
460
461 <?php do_action( 'wpforo_dashboard_forum_form_main', $data ); ?>
462
463 </div>
464 <div id="advanced-sortables" class="meta-box-sortables ui-sortable"></div>
465 </div>
466
467 </div>
468 </form>
469 </div>
470 <?php endif; ?><!-- chekcing creat forum permission-->
471 <?php endif; ?>
472 <!-- end Forum Add || Edit -->
473
474 <!-- Forum Delete -->
475 <?php if( $action === 'del' ) : ?>
476 <form method="POST">
477 <?php wp_nonce_field( 'wpforo-forum-delete' ); ?>
478 <input type="hidden" name="wpfaction" value="forum_delete">
479 <div class="form-wrap">
480 <div class="form-field form-required">
481 <div class="form-field wpf-info-bar" style="padding:25px 20px 15px 20px; margin-top:20px;">
482 <table class="wpforo_settings_table">
483 <tr>
484 <td style="width:50%;">
485 <label for="delete_forum" class="menu_delete" style="color: red; font-size:13px; line-height:18px;"><?php _e( 'This action will also delete all sub-forums, topics and replies.', 'wpforo' ); ?></label>
486 </td>
487 <td>
488 <input id="delete_forum" type="radio" name="forum[delete]" value="1" checked="" onchange="mode_changer(false);">
489 </td>
490 </tr>
491 <tr>
492 <td>
493 <label for="marge" style="font-size:13px; line-height:18px;"><?php _e( 'If you want to delete this forum and keep its sub-forums, topics and replies, please select a new target forum in dropdown below', 'wpforo' ); ?></label>
494 </td>
495 <td><input id="marge" type="radio" name="forum[delete]" value="0" onchange="mode_changer(true);"></td>
496 </tr>
497 <tr>
498 <td colspan="2">
499 <select id="forum_select" name="forum[mergeid]" class="postform" disabled="">
500 <?php WPF()->forum->tree( 'select_box', false ); ?>
501 </select>
502 <p><?php _e( 'All sub-forums, topics and replies will be attached to selected forum. Layout will be inherited from this forum.', 'wpforo' ); ?></p>
503 </td>
504 </tr>
505 <tr>
506 <td colspan="2">
507 <input id="forum_submit" type="submit" name="forum[submit]" class="button button-primary" value="Delete">
508 </td>
509 </tr>
510 </table>
511 </div>
512 </div>
513 </div>
514 </form>
515 <?php endif; ?>
516 <!-- end Forum Delete -->
517
518 </div><!-- wpwrap -->
519