| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* New/Edit Forum |
| 5 |
* |
| 6 |
* @package bbPress |
| 7 |
* @subpackage Theme |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
defined( 'ABSPATH' ) || exit; |
| 12 |
|
| 13 |
if ( bbp_is_forum_edit() ) : ?> |
| 14 |
|
| 15 |
<div id="bbpress-forums" class="bbpress-wrapper"> |
| 16 |
|
| 17 |
<?php bbp_single_forum_description( array( 'forum_id' => bbp_get_forum_id() ) ); ?> |
| 18 |
|
| 19 |
<?php endif; ?> |
| 20 |
|
| 21 |
<?php if ( bbp_current_user_can_access_create_forum_form() ) : ?> |
| 22 |
|
| 23 |
<div id="new-forum-<?php bbp_forum_id(); ?>" class="bbp-forum-form"> |
| 24 |
|
| 25 |
<form id="new-post" name="new-post" method="post"> |
| 26 |
|
| 27 |
<?php do_action( 'bbp_theme_before_forum_form' ); ?> |
| 28 |
|
| 29 |
<fieldset class="bbp-form"> |
| 30 |
<legend> |
| 31 |
|
| 32 |
<?php |
| 33 |
if ( bbp_is_forum_edit() ) : |
| 34 |
printf( esc_html__( 'Now Editing “%s”', 'forumax' ), bbp_get_forum_title() ); |
| 35 |
else : |
| 36 |
bbp_is_single_forum() |
| 37 |
? printf( esc_html__( 'Create New Forum in “%s”', 'forumax' ), bbp_get_forum_title() ) |
| 38 |
: esc_html_e( 'Create New Forum', 'forumax' ); |
| 39 |
endif; |
| 40 |
?> |
| 41 |
|
| 42 |
</legend> |
| 43 |
|
| 44 |
<?php do_action( 'bbp_theme_before_forum_form_notices' ); ?> |
| 45 |
|
| 46 |
<?php if ( ! bbp_is_forum_edit() && bbp_is_forum_closed() ) : ?> |
| 47 |
|
| 48 |
<div class="bbp-template-notice"> |
| 49 |
<ul> |
| 50 |
<li><?php esc_html_e( 'This forum is closed to new content, however your posting capabilities still allow you to post.', 'forumax' ); ?></li> |
| 51 |
</ul> |
| 52 |
</div> |
| 53 |
|
| 54 |
<?php endif; ?> |
| 55 |
|
| 56 |
<?php if ( current_user_can( 'unfiltered_html' ) ) : ?> |
| 57 |
|
| 58 |
<div class="bbp-template-notice"> |
| 59 |
<ul> |
| 60 |
<li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'forumax' ); ?></li> |
| 61 |
</ul> |
| 62 |
</div> |
| 63 |
|
| 64 |
<?php endif; ?> |
| 65 |
|
| 66 |
<?php do_action( 'bbp_template_notices' ); ?> |
| 67 |
|
| 68 |
<div> |
| 69 |
|
| 70 |
<?php do_action( 'bbp_theme_before_forum_form_title' ); ?> |
| 71 |
|
| 72 |
<p> |
| 73 |
<label for="bbp_forum_title"><?php printf( esc_html__( 'Forum Name (Maximum Length: %d):', 'forumax' ), bbp_get_title_max_length() ); ?></label><br /> |
| 74 |
<input type="text" id="bbp_forum_title" value="<?php bbp_form_forum_title(); ?>" size="40" name="bbp_forum_title" maxlength="<?php bbp_title_max_length(); ?>" /> |
| 75 |
</p> |
| 76 |
|
| 77 |
<?php do_action( 'bbp_theme_after_forum_form_title' ); ?> |
| 78 |
|
| 79 |
<?php do_action( 'bbp_theme_before_forum_form_content' ); ?> |
| 80 |
|
| 81 |
<?php bbp_the_content( array( 'context' => 'forum' ) ); ?> |
| 82 |
|
| 83 |
<?php do_action( 'bbp_theme_after_forum_form_content' ); ?> |
| 84 |
|
| 85 |
<?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?> |
| 86 |
|
| 87 |
<p class="form-allowed-tags"> |
| 88 |
<label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','forumax' ); ?></label><br /> |
| 89 |
<code><?php bbp_allowed_tags(); ?></code> |
| 90 |
</p> |
| 91 |
|
| 92 |
<?php endif; ?> |
| 93 |
|
| 94 |
<?php if ( bbp_allow_forum_mods() && current_user_can( 'assign_moderators' ) ) : ?> |
| 95 |
|
| 96 |
<?php do_action( 'bbp_theme_before_forum_form_mods' ); ?> |
| 97 |
|
| 98 |
<p> |
| 99 |
<label for="bbp_moderators"><?php esc_html_e( 'Forum Moderators:', 'forumax' ); ?></label><br /> |
| 100 |
<input type="text" value="<?php bbp_form_forum_moderators(); ?>" size="40" name="bbp_moderators" id="bbp_moderators" /> |
| 101 |
</p> |
| 102 |
|
| 103 |
<?php do_action( 'bbp_theme_after_forum_form_mods' ); ?> |
| 104 |
|
| 105 |
<?php endif; ?> |
| 106 |
|
| 107 |
<?php do_action( 'bbp_theme_before_forum_form_type' ); ?> |
| 108 |
|
| 109 |
<p> |
| 110 |
<label for="bbp_forum_type"><?php esc_html_e( 'Forum Type:', 'forumax' ); ?></label><br /> |
| 111 |
<?php bbp_form_forum_type_dropdown(); ?> |
| 112 |
</p> |
| 113 |
|
| 114 |
<?php do_action( 'bbp_theme_after_forum_form_type' ); ?> |
| 115 |
|
| 116 |
<?php do_action( 'bbp_theme_before_forum_form_status' ); ?> |
| 117 |
|
| 118 |
<p> |
| 119 |
<label for="bbp_forum_status"><?php esc_html_e( 'Status:', 'forumax' ); ?></label><br /> |
| 120 |
<?php bbp_form_forum_status_dropdown(); ?> |
| 121 |
</p> |
| 122 |
|
| 123 |
<?php do_action( 'bbp_theme_after_forum_form_status' ); ?> |
| 124 |
|
| 125 |
<?php do_action( 'bbp_theme_before_forum_visibility_status' ); ?> |
| 126 |
|
| 127 |
<p> |
| 128 |
<label for="bbp_forum_visibility"><?php esc_html_e( 'Visibility:', 'forumax' ); ?></label><br /> |
| 129 |
<?php bbp_form_forum_visibility_dropdown(); ?> |
| 130 |
</p> |
| 131 |
|
| 132 |
<?php do_action( 'bbp_theme_after_forum_visibility_status' ); ?> |
| 133 |
|
| 134 |
<?php do_action( 'bbp_theme_before_forum_form_parent' ); ?> |
| 135 |
|
| 136 |
<p> |
| 137 |
<label for="bbp_forum_parent_id"><?php esc_html_e( 'Parent Forum:', 'forumax' ); ?></label><br /> |
| 138 |
|
| 139 |
<?php |
| 140 |
bbp_dropdown( array( |
| 141 |
'select_id' => 'bbp_forum_parent_id', |
| 142 |
'show_none' => esc_html__( '— No parent —', 'forumax' ), |
| 143 |
'selected' => bbp_get_form_forum_parent(), |
| 144 |
'exclude' => bbp_get_forum_id() |
| 145 |
) ); |
| 146 |
?> |
| 147 |
</p> |
| 148 |
|
| 149 |
<?php do_action( 'bbp_theme_after_forum_form_parent' ); ?> |
| 150 |
|
| 151 |
<?php do_action( 'bbp_theme_before_forum_form_submit_wrapper' ); ?> |
| 152 |
|
| 153 |
<div class="bbp-submit-wrapper"> |
| 154 |
|
| 155 |
<?php do_action( 'bbp_theme_before_forum_form_submit_button' ); ?> |
| 156 |
|
| 157 |
<button type="submit" id="bbp_forum_submit" name="bbp_forum_submit" class="button submit fill-brand"> |
| 158 |
<?php esc_html_e( 'Submit', 'forumax' ); ?> |
| 159 |
</button> |
| 160 |
|
| 161 |
<?php do_action( 'bbp_theme_after_forum_form_submit_button' ); ?> |
| 162 |
|
| 163 |
</div> |
| 164 |
|
| 165 |
<?php do_action( 'bbp_theme_after_forum_form_submit_wrapper' ); ?> |
| 166 |
|
| 167 |
</div> |
| 168 |
|
| 169 |
<?php bbp_forum_form_fields(); ?> |
| 170 |
|
| 171 |
</fieldset> |
| 172 |
|
| 173 |
<?php do_action( 'bbp_theme_after_forum_form' ); ?> |
| 174 |
|
| 175 |
</form> |
| 176 |
</div> |
| 177 |
|
| 178 |
<?php elseif ( bbp_is_forum_closed() ) : ?> |
| 179 |
|
| 180 |
<div id="no-forum-<?php bbp_forum_id(); ?>" class="bbp-no-forum"> |
| 181 |
<div class="bbp-template-notice"> |
| 182 |
<ul> |
| 183 |
<li><?php printf( esc_html__( 'The forum ‘%s’ is closed to new content.', 'forumax' ), bbp_get_forum_title() ); ?></li> |
| 184 |
</ul> |
| 185 |
</div> |
| 186 |
</div> |
| 187 |
|
| 188 |
<?php else : ?> |
| 189 |
|
| 190 |
<div id="no-forum-<?php bbp_forum_id(); ?>" class="bbp-no-forum"> |
| 191 |
<div class="bbp-template-notice"> |
| 192 |
<ul> |
| 193 |
<li><?php is_user_logged_in() |
| 194 |
? esc_html_e( 'You cannot create new forums.', 'forumax' ) |
| 195 |
: esc_html_e( 'You must be logged in to create new forums.', 'forumax' ); |
| 196 |
?></li> |
| 197 |
</ul> |
| 198 |
</div> |
| 199 |
</div> |
| 200 |
|
| 201 |
<?php endif; ?> |
| 202 |
|
| 203 |
<?php if ( bbp_is_forum_edit() ) : ?> |
| 204 |
|
| 205 |
</div> |
| 206 |
|
| 207 |
<?php endif; |