/templates/default/bbpress/form-topic.php

  1. <?php 
  2.  
  3. /** 
  4. * New/Edit Topic 
  5. * 
  6. * @package bbPress 
  7. * @subpackage Theme 
  8. */ 
  9.  
  10. ?> 
  11.  
  12. <?php if ( !bbp_is_single_forum() ) : ?> 
  13.  
  14. <div id="bbpress-forums"> 
  15.  
  16. <?php bbp_breadcrumb(); ?> 
  17.  
  18. <?php endif; ?> 
  19.  
  20. <?php if ( bbp_is_topic_edit() ) : ?> 
  21.  
  22. <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?> 
  23.  
  24. <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?> 
  25.  
  26. <?php endif; ?> 
  27.  
  28. <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?> 
  29.  
  30. <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form"> 
  31.  
  32. <form id="new-post" name="new-post" method="post" action="<?php the_permalink(); ?>"> 
  33.  
  34. <?php do_action( 'bbp_theme_before_topic_form' ); ?> 
  35.  
  36. <fieldset class="bbp-form"> 
  37. <legend> 
  38.  
  39. <?php 
  40. if ( bbp_is_topic_edit() ) 
  41. printf( __( 'Now Editing “%s”', 'bbpress' ), bbp_get_topic_title() ); 
  42. else 
  43. bbp_is_single_forum() ? printf( __( 'Create New Topic in “%s”', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' ); 
  44. ?> 
  45.  
  46. </legend> 
  47.  
  48. <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?> 
  49.  
  50. <?php if ( !bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?> 
  51.  
  52. <div class="bbp-template-notice"> 
  53. <p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p> 
  54. </div> 
  55.  
  56. <?php endif; ?> 
  57.  
  58. <?php if ( current_user_can( 'unfiltered_html' ) ) : ?> 
  59.  
  60. <div class="bbp-template-notice"> 
  61. <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p> 
  62. </div> 
  63.  
  64. <?php endif; ?> 
  65.  
  66. <?php do_action( 'bbp_template_notices' ); ?> 
  67.  
  68. <div> 
  69.  
  70. <?php bbp_get_template_part( 'form', 'anonymous' ); ?> 
  71.  
  72. <?php do_action( 'bbp_theme_before_topic_form_title' ); ?> 
  73.  
  74. <p> 
  75. <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br /> 
  76. <input type="text" id="bbp_topic_title" value="<?php bbp_form_topic_title(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_title" maxlength="<?php bbp_title_max_length(); ?>" /> 
  77. </p> 
  78.  
  79. <?php do_action( 'bbp_theme_after_topic_form_title' ); ?> 
  80.  
  81. <?php do_action( 'bbp_theme_before_topic_form_content' ); ?> 
  82.  
  83. <?php bbp_the_content( array( 'context' => 'topic' ) ); ?> 
  84.  
  85. <?php do_action( 'bbp_theme_after_topic_form_content' ); ?> 
  86.  
  87. <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?> 
  88.  
  89. <p class="form-allowed-tags"> 
  90. <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br /> 
  91. <code><?php bbp_allowed_tags(); ?></code> 
  92. </p> 
  93.  
  94. <?php endif; ?> 
  95.  
  96. <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?> 
  97.  
  98. <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?> 
  99.  
  100. <p> 
  101. <label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br /> 
  102. <input type="text" value="<?php bbp_form_topic_tags(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_tags" id="bbp_topic_tags" <?php disabled( bbp_is_topic_spam() ); ?> /> 
  103. </p> 
  104.  
  105. <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?> 
  106.  
  107. <?php endif; ?> 
  108.  
  109. <?php if ( !bbp_is_single_forum() ) : ?> 
  110.  
  111. <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?> 
  112.  
  113. <p> 
  114. <label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br /> 
  115. <?php 
  116. bbp_dropdown( array( 
  117. 'show_none' => __( '(No Forum)', 'bbpress' ),  
  118. 'selected' => bbp_get_form_topic_forum() 
  119. ) ); 
  120. ?> 
  121. </p> 
  122.  
  123. <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?> 
  124.  
  125. <?php endif; ?> 
  126.  
  127. <?php if ( current_user_can( 'moderate' ) ) : ?> 
  128.  
  129. <?php do_action( 'bbp_theme_before_topic_form_type' ); ?> 
  130.  
  131. <p> 
  132.  
  133. <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br /> 
  134.  
  135. <?php bbp_form_topic_type_dropdown(); ?> 
  136.  
  137. </p> 
  138.  
  139. <?php do_action( 'bbp_theme_after_topic_form_type' ); ?> 
  140.  
  141. <?php do_action( 'bbp_theme_before_topic_form_status' ); ?> 
  142.  
  143. <p> 
  144.  
  145. <label for="bbp_topic_status"><?php _e( 'Topic Status:', 'bbpress' ); ?></label><br /> 
  146.  
  147. <?php bbp_form_topic_status_dropdown(); ?> 
  148.  
  149. </p> 
  150.  
  151. <?php do_action( 'bbp_theme_after_topic_form_status' ); ?> 
  152.  
  153. <?php endif; ?> 
  154.  
  155. <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?> 
  156.  
  157. <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?> 
  158.  
  159. <p> 
  160. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 
  161.  
  162. <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?> 
  163.  
  164. <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label> 
  165.  
  166. <?php else : ?> 
  167.  
  168. <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label> 
  169.  
  170. <?php endif; ?> 
  171. </p> 
  172.  
  173. <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?> 
  174.  
  175. <?php endif; ?> 
  176.  
  177. <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?> 
  178.  
  179. <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?> 
  180.  
  181. <fieldset class="bbp-form"> 
  182. <legend> 
  183. <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 
  184. <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br /> 
  185. </legend> 
  186.  
  187. <div> 
  188. <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br /> 
  189. <input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_edit_reason" id="bbp_topic_edit_reason" /> 
  190. </div> 
  191. </fieldset> 
  192.  
  193. <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?> 
  194.  
  195. <?php endif; ?> 
  196.  
  197. <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?> 
  198.  
  199. <div class="bbp-submit-wrapper"> 
  200.  
  201. <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?> 
  202.  
  203. <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 
  204.  
  205. <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?> 
  206.  
  207. </div> 
  208.  
  209. <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?> 
  210.  
  211. </div> 
  212.  
  213. <?php bbp_topic_form_fields(); ?> 
  214.  
  215. </fieldset> 
  216.  
  217. <?php do_action( 'bbp_theme_after_topic_form' ); ?> 
  218.  
  219. </form> 
  220. </div> 
  221.  
  222. <?php elseif ( bbp_is_forum_closed() ) : ?> 
  223.  
  224. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic"> 
  225. <div class="bbp-template-notice"> 
  226. <p><?php printf( __( 'The forum ‘%s’ is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p> 
  227. </div> 
  228. </div> 
  229.  
  230. <?php else : ?> 
  231.  
  232. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic"> 
  233. <div class="bbp-template-notice"> 
  234. <p><?php is_user_logged_in() ? _e( 'You cannot create new topics.', 'bbpress' ) : _e( 'You must be logged in to create new topics.', 'bbpress' ); ?></p> 
  235. </div> 
  236. </div> 
  237.  
  238. <?php endif; ?> 
  239.  
  240. <?php if ( !bbp_is_single_forum() ) : ?> 
  241.  
  242. </div> 
  243.  
  244. <?php endif; ?> 
.