| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
if( !current_user_can('administrator') ) exit; |
| 5 |
?> |
| 6 |
|
| 7 |
<!-- Screen Options --> |
| 8 |
<?php if( isset($_GET['action']) && $_GET['action'] == 'add' || isset($_GET['action']) && $_GET['action'] == 'edit') : ?> |
| 9 |
|
| 10 |
<div id="screen-meta" class="metabox-prefs" style="display: none; "> |
| 11 |
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="Screen Options Tab" style="display: none; "> |
| 12 |
<form id="adv-settings" action="" method="post"> |
| 13 |
<h5><?php _e('Show on screen', 'wpforo'); ?></h5> |
| 14 |
<div class="metabox-prefs"> |
| 15 |
<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> |
| 16 |
<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> |
| 17 |
<label for="forum_slug-hide"><input class="hide-postbox-tog" name="forum_slug-hide" type="checkbox" id="forum_slug-hide" value="forum_slug"><?php _e('Slug', 'wpforo'); ?></label> |
| 18 |
<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> |
| 19 |
<br class="clear"> |
| 20 |
</div> |
| 21 |
<h5 class="screen-layout"><?php _e('Screen Layout', 'wpforo'); ?></h5> |
| 22 |
<div class="columns-prefs"><?php _e('Number of Columns', 'wpforo'); ?>: |
| 23 |
<label class="columns-prefs-1"><input type="radio" name="screen_columns" value="1">1</label> |
| 24 |
<label class="columns-prefs-2"><input type="radio" name="screen_columns" value="2" checked="checked">2</label> |
| 25 |
</div> |
| 26 |
</form> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
|
| 30 |
<div id="screen-meta-links"> |
| 31 |
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle" style=""> |
| 32 |
<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> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
|
| 36 |
<?php endif; ?> |
| 37 |
<!-- end Screen Options --> |
| 38 |
|
| 39 |
<div id="icon-edit" class="icon32 icon32-posts-post"></div> |
| 40 |
<div id="wpf-admin-wrap" class="wrap"> |
| 41 |
|
| 42 |
<h2 style="padding:30px 0px 10px 0px; line-height: 20px;"> |
| 43 |
<?php _e('Categories and Forums', 'wpforo'); ?> |
| 44 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&action=add' ) ?>" class="add-new-h2"><?php _e('Add New', 'wpforo'); ?></a> |
| 45 |
</h2> |
| 46 |
|
| 47 |
<?php $wpforo->notice->show(FALSE) ?> |
| 48 |
|
| 49 |
<!-- Forum Hierarchy --> |
| 50 |
<?php if( !isset($_GET['action'])) : ?> |
| 51 |
<?php if($wpforo->perm->usergroup_can('ef')): ?> |
| 52 |
|
| 53 |
<div class="wpf-info-bar" style="line-height: 1em; clear:both; padding: 5px 30px; font-size:15px; display:block; box-shadow:none; margin: 20px 0 10px 0; font-style: italic; background: #FFFFC6; width:90%;"> |
| 54 |
<ul style="list-style-type: disc; line-height:18px;"> |
| 55 |
<li style="list-style:none; margin-left:-17px; font-style:normal; font-weight:bold;"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Important Tips', 'wpforo'); ?></li> |
| 56 |
<li><?php _e('Please drag and drop forum panels to set parent-child hierarchy.', 'wpforo'); ?></li> |
| 57 |
<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> |
| 58 |
<li><?php _e('Forums can be displayed with different layouts (Extended, Simplified, Q&A), 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> |
| 59 |
</ul> |
| 60 |
</div> |
| 61 |
<br style="clear: both;" /> |
| 62 |
|
| 63 |
<form id="forum-hierarchy" encType="multipart/form-data" method="post" action=""> |
| 64 |
<?php wp_nonce_field( 'wpforo-forums-hierarchy' ); ?> |
| 65 |
<input type="hidden" name="forums_hierarchy_submit"/> |
| 66 |
<div id="post-body"> |
| 67 |
<ul id="menu-to-edit" class="menu"> |
| 68 |
|
| 69 |
<?php $wpforo->forum->tree('drag_menu'); ?> |
| 70 |
|
| 71 |
</ul> |
| 72 |
</div><br /> |
| 73 |
<div class="major-publishing-actions"> |
| 74 |
<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> |
| 75 |
</div> |
| 76 |
</form> |
| 77 |
<script> |
| 78 |
var menus = false; |
| 79 |
navMenuL10n.saveAlert = null; |
| 80 |
window.onbeforeunload=function(){if(a.menusChanged){return navMenuL10n.saveAlert}} |
| 81 |
</script> |
| 82 |
<?php endif; ?><!--checking edit forum permission--> |
| 83 |
<?php endif; ?> |
| 84 |
<!-- end Forum Hierarchy --> |
| 85 |
<br style="clear: both;"/> |
| 86 |
<!-- Forum Add || Edit --> |
| 87 |
<?php if( ( isset($_GET['action']) && $_GET['action'] == 'add' ) || ( isset($_GET['action']) && $_GET['action'] == 'edit' ) ) : ?> |
| 88 |
<?php if($wpforo->perm->usergroup_can('cf')): ?> |
| 89 |
<?php if(isset($_GET['id'])) $data = $wpforo->forum->get_forum( array('forumid' => $_GET['id']) ); ?> |
| 90 |
<div id="poststuff"> |
| 91 |
<form name="forum" action="" method="post"> |
| 92 |
<?php wp_nonce_field( 'wpforo-forum-addedit' ); ?> |
| 93 |
<div id="post-body" class="metabox-holder columns-2"> |
| 94 |
<div id="post-body-content"> |
| 95 |
<input type="hidden" name="wpforo_submit" value="1"/> |
| 96 |
<input type="hidden" name="forum[order]" value="<?php echo esc_attr(isset($data['order']) ? $data['order'] : '') ?>"/> |
| 97 |
<div class="form-wrap"> |
| 98 |
<div class="form-field form-required" style="margin-bottom:0px; padding-bottom:0px;"> |
| 99 |
<div id="titlediv"> |
| 100 |
<div id="titlewrap"> |
| 101 |
<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'); ?>" /> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
<p> </p> |
| 105 |
<div class="form-field"> |
| 106 |
<textarea placeholder="<?php _e('Enter description here . . .', 'wpforo'); ?>" name="forum[description]" rows="5" cols="40" style="padding:10px;"><?php echo esc_textarea(isset($data['description']) ? $data['description'] : '') ?></textarea> |
| 107 |
<p><?php _e('This is a forum description. This content will be displayed under forum title on the forum list.', 'wpforo'); ?></p> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
|
| 113 |
<div id="postbox-container-1" class="postbox-container"> |
| 114 |
<div id="side-sortables" class="meta-box-sortables ui-sortable"> |
| 115 |
|
| 116 |
|
| 117 |
<div id="forum_cat" class="postbox" style="display: block; "> |
| 118 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 119 |
<h3 class="hndle"><span><?php _e('Forum Options', 'wpforo'); ?></span></h3> |
| 120 |
<div class="inside"> |
| 121 |
<div class="form-field"> |
| 122 |
<p><strong><?php _e('Parent Forum', 'wpforo'); ?></strong></p> |
| 123 |
<p> |
| 124 |
<select id="parent" name="forum[parentid]" class="postform" <?php echo (isset($data['is_cat']) && $data['is_cat'] == 1 ? 'disabled' : '') ?>> |
| 125 |
<option value="0"><?php _e('No parent', 'wpforo'); ?></option> |
| 126 |
<?php $wpforo->forum->tree('select_box'); ?> |
| 127 |
</select> |
| 128 |
</p> |
| 129 |
<p class="form-field"> |
| 130 |
<label for="use_us_cat"><?php _e('Use as Category', 'wpforo'); ?> <input id="use_us_cat" onclick="document.getElementById('parent').disabled = this.checked; document.getElementById('cat_layout').disabled = !this.checked;" type="checkbox" name="forum[is_cat]" value="1" <?php echo (isset($data['is_cat']) && $data['is_cat'] == 1 ? 'checked' : '') ?>/> </label> |
| 131 |
</p> |
| 132 |
<p><strong><?php _e('Category Layout', 'wpforo'); ?></strong></p> |
| 133 |
<p> |
| 134 |
<?php $layouts = $wpforo->tpl->find_layouts( WPFORO_THEME ); ?> |
| 135 |
<?php if(!empty($layouts)): ?> |
| 136 |
<select id="cat_layout" name="forum[cat_layout]" class="postform" <?php $data['cat_layout'] = ( isset($data['cat_layout']) ? $data['cat_layout'] : 1 ); echo ( isset($data['is_cat']) && $data['is_cat'] == 1 ? '' : 'disabled="TRUE"' ); ?> > |
| 137 |
<?php $wpforo->tpl->show_layout_selectbox($data['cat_layout']); ?> |
| 138 |
</select> |
| 139 |
<?php else: ?> |
| 140 |
<p><?php _e('No layout found.', 'wpforo'); ?></p> |
| 141 |
<?php endif; ?> |
| 142 |
</p> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
|
| 147 |
<div id="submitdiv" class="postbox" style="display: block; "> |
| 148 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 149 |
<h3 class="hndle"><span><?php _e('Publish', 'wpforo'); ?></span></h3> |
| 150 |
<div class="inside"> |
| 151 |
<div id="major-publishing-actions" style="text-align:right;"> |
| 152 |
<?php if( $_GET['action'] == 'edit' ) : ?> |
| 153 |
<a class="wpf-delete button" href="?page=wpforo-forums&id=<?php echo intval($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> |
| 154 |
<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> |
| 155 |
<?php endif; ?> |
| 156 |
<input type="submit" name="forum[save_edit]" class="button button-primary forum_submit" style="display:inline-block;float:none;" value="<?php _e('Publish', 'wpforo'); ?>"> |
| 157 |
<div class="clear"></div> |
| 158 |
</div> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
|
| 162 |
|
| 163 |
<div id="forum_permissions" class="postbox" style="display: block; "> |
| 164 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 165 |
<h3 class="hndle"><span>Forum Permissions</span></h3> |
| 166 |
<div class="inside"> |
| 167 |
<table> |
| 168 |
<?php $wpforo->forum->permissions(); ?> |
| 169 |
</table> |
| 170 |
</div> |
| 171 |
</div> |
| 172 |
|
| 173 |
<?php if( get_option('wpforo_integrate_s2member') == 1 && false ) : ?> |
| 174 |
|
| 175 |
<?php |
| 176 |
|
| 177 |
if(isset( $_GET['id'] )){ |
| 178 |
$srlz = get_option( 'wpforo_s2member_items_levels' ); |
| 179 |
$s2member_items_levels = unserialize( $srlz ); |
| 180 |
|
| 181 |
for( $i = 0; $i < 5; $i++ ){ |
| 182 |
$f_ids = explode(',', $s2member_items_levels['level'.$i.'_forums']); |
| 183 |
if(in_array( $_GET['id'], $f_ids)){ |
| 184 |
$lvl = $i; |
| 185 |
break; |
| 186 |
} |
| 187 |
unset($f_ids); |
| 188 |
} |
| 189 |
}else{ |
| 190 |
$lvl = -1; |
| 191 |
} |
| 192 |
|
| 193 |
?> |
| 194 |
|
| 195 |
<div id="ws-plugin--s2member-security" class="postbox " style="display: block; "> |
| 196 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 197 |
<h3 class="hndle"><span>s2Member®</span></h3> |
| 198 |
<div class="inside"> |
| 199 |
|
| 200 |
<p style="margin-left:2px;"><strong>Forum Level Restriction?</strong></p> |
| 201 |
<label class="screen-reader-text" for="ws-plugin--s2member-security-meta-box-level">Add Level Restriction?</label> |
| 202 |
<select name="forum[s2member_level]" id="ws-plugin--s2member-security-meta-box-level" style="width:99%;"> |
| 203 |
<option value=""></option> |
| 204 |
<option value="0" <?php echo ( $lvl != null && $lvl == 0 ? 'selected' : '' ); ?> >Require Level #0 (or higher)</option> |
| 205 |
<option value="1" <?php echo ( $lvl != null && $lvl == 1 ? 'selected' : '' ); ?> >Require Level #1 (or higher)</option> |
| 206 |
<option value="2" <?php echo ( $lvl != null && $lvl == 2 ? 'selected' : '' ); ?> >Require Level #2 (or higher)</option> |
| 207 |
<option value="3" <?php echo ( $lvl != null && $lvl == 3 ? 'selected' : '' ); ?> >Require Level #3 (or higher)</option> |
| 208 |
<option value="4" <?php echo ( $lvl != null && $lvl == 4 ? 'selected' : '' ); ?> >Require Highest Level #4</option> |
| 209 |
</select><br> |
| 210 |
|
| 211 |
</div> |
| 212 |
</div> |
| 213 |
|
| 214 |
<?php endif; ?> |
| 215 |
|
| 216 |
</div> |
| 217 |
</div> |
| 218 |
|
| 219 |
<div id="postbox-container-2" class="postbox-container"> |
| 220 |
<div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
| 221 |
|
| 222 |
<div id="forum_slug" class="postbox hide-if-js" style="display: none; "> |
| 223 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 224 |
<h3 class="hndle"><span><?php _e('Forum Slug', 'wpforo'); ?></span></h3> |
| 225 |
<div class="inside"> |
| 226 |
<input name="forum[slug]" type="text" value="<?php echo esc_attr(isset($data['slug']) ? $data['slug'] : '') ?>" size="40" /> |
| 227 |
<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 /> |
| 228 |
</div> |
| 229 |
</div> |
| 230 |
|
| 231 |
<div id="forum_icon" class="postbox hide-if-js" style="display: block; "> |
| 232 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 233 |
<h3 class="hndle"><span><?php _e('Forum Icon', 'wpforo'); ?></span></h3> |
| 234 |
<div class="inside" style="padding-top:10px;"> |
| 235 |
<div class="form-field"> |
| 236 |
<label for="tag-icon" style="display:block; padding-bottom:5px;"><?php _e('Font-awesome Icon', 'wpforo'); ?>:</label> |
| 237 |
<input name="forum[icon]" value="<?php echo (isset($data['icon']) && $data['icon']) ? esc_attr($data['icon']) : 'fa-comments'; ?>" type="text"/> |
| 238 |
<p style="margin-bottom:0px; 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 "fa-comments".', '') ?></p> |
| 239 |
</div> |
| 240 |
</div> |
| 241 |
</div> |
| 242 |
|
| 243 |
<div id="forum_meta" class="postbox hide-if-js" style="display: block; "> |
| 244 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 245 |
<h3 class="hndle"><span><?php _e('Forum SEO', 'wpforo'); ?></span></h3> |
| 246 |
<div class="inside" style="padding-top:10px;"> |
| 247 |
<div class="form-field"> |
| 248 |
<label for="tag-description" style="display:block; padding-bottom:5px;"><?php _e('Meta Description', 'wpforo'); ?>:</label> |
| 249 |
<textarea name="forum[meta_desc]" rows="3" cols="40"><?php echo esc_html(isset($data['meta_desc']) ? $data['meta_desc'] : '') ?></textarea> |
| 250 |
</div> |
| 251 |
</div> |
| 252 |
</div> |
| 253 |
|
| 254 |
</div> |
| 255 |
<div id="advanced-sortables" class="meta-box-sortables ui-sortable"></div> |
| 256 |
</div> |
| 257 |
|
| 258 |
</div> |
| 259 |
</form> |
| 260 |
</div> |
| 261 |
<?php endif; ?><!-- chekcing creat forum permission--> |
| 262 |
<?php endif; ?> |
| 263 |
<!-- end Forum Add || Edit --> |
| 264 |
|
| 265 |
<!-- Forum Delete --> |
| 266 |
<?php if( isset($_GET['action']) && $_GET['action'] == 'del') : ?> |
| 267 |
|
| 268 |
<form action="" method="post"> |
| 269 |
<?php wp_nonce_field( 'wpforo-forum-delete' ); ?> |
| 270 |
<input type="hidden" name="wpforo_delete" value="1"/> |
| 271 |
<div class="form-wrap"> |
| 272 |
<div class="form-field form-required"> |
| 273 |
<div class="form-field wpf-info-bar" style="padding:25px 20px 15px 20px; margin-top:20px;"> |
| 274 |
<table class="wpforo_settings_table"> |
| 275 |
<tr> |
| 276 |
<td style="width:50%;"> |
| 277 |
<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> |
| 278 |
</td> |
| 279 |
<td width="20px"> |
| 280 |
<input id="delete_forum" type="radio" name="forum[delete]" value="1" checked="" onchange="mode_changer('false');"/> |
| 281 |
</td> |
| 282 |
</tr> |
| 283 |
<tr> |
| 284 |
<td> |
| 285 |
<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> |
| 286 |
</td> |
| 287 |
<td><input id="marge" type="radio" name="forum[delete]" value="0" onchange="mode_changer('true');"/> </td> |
| 288 |
</tr> |
| 289 |
<tr> |
| 290 |
<td colspan="2"> |
| 291 |
<select id="forum_select" name="forum[mergeid]" class="postform" disabled="" > |
| 292 |
<?php $wpforo->forum->tree('select_box', false); ?> |
| 293 |
</select> |
| 294 |
<p><?php _e('All sub-forums, topics and replies will be attached to selected forum. Layout will be inherited from this forum.', 'wpforo'); ?></p> |
| 295 |
</td> |
| 296 |
</tr> |
| 297 |
<tr> |
| 298 |
<td colspan="2"> |
| 299 |
<input id="forum_submit" type="submit" name="forum[submit]" class="button button-primary" value="Delete" /> |
| 300 |
</td> |
| 301 |
</tr> |
| 302 |
</table> |
| 303 |
</div> |
| 304 |
</div> |
| 305 |
</div> |
| 306 |
</form> |
| 307 |
<?php endif; ?> |
| 308 |
<!-- end Forum Delete --> |
| 309 |
|
| 310 |
</div><!-- wpwrap --> |