PluginProbe
wpForo Forum / 3.0.9
wpForo Forum v3.0.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 3.0.9, at admin/pages/forum.php

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