/wp-content/themes/openlab/bbpress/form-topic.php

https://github.com/livinglab/openlab · PHP · 251 lines · 143 code · 88 blank · 20 comment · 25 complexity · 0c278ae6072bf8879805dc912df3842c MD5 · raw file

  1. <?php
  2. /**
  3. * New/Edit Topic
  4. *
  5. * @package bbPress
  6. * @subpackage Theme
  7. */
  8. ?>
  9. <?php if ( ! bbp_is_single_forum() ) : ?>
  10. <div id="bbpress-forums">
  11. <?php bbp_breadcrumb(); ?>
  12. <?php endif; ?>
  13. <?php if ( bbp_is_topic_edit() ) : ?>
  14. <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
  15. <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
  16. <?php endif; ?>
  17. <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
  18. <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
  19. <form class="form form-panel" id="new-post" name="new-post" method="post" action="">
  20. <?php do_action( 'bbp_theme_before_topic_form' ); ?>
  21. <div class="bbp-form panel panel-default">
  22. <div class="panel-heading">
  23. <?php
  24. if ( bbp_is_topic_edit() ) {
  25. printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
  26. } else {
  27. bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
  28. }
  29. ?>
  30. </div>
  31. <div class="panel-body">
  32. <?php
  33. /*
  34. <legend>
  35. <?php
  36. if ( bbp_is_topic_edit() )
  37. printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
  38. else
  39. bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
  40. ?>
  41. </legend>
  42. <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
  43. */
  44. ?>
  45. <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
  46. <div class="bbp-template-notice">
  47. <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
  48. </div>
  49. <?php endif; ?>
  50. <?php do_action( 'bbp_template_notices' ); ?>
  51. <div>
  52. <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
  53. <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
  54. <p>
  55. <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
  56. <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(); ?>" />
  57. </p>
  58. <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
  59. <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
  60. <?php
  61. bbp_the_content(
  62. array(
  63. 'context' => 'topic',
  64. 'editor_class' => 'bbp-the-content bp-suggestions',
  65. )
  66. );
  67. ?>
  68. <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
  69. <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
  70. <p class="form-allowed-tags">
  71. <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br />
  72. <code><?php bbp_allowed_tags(); ?></code>
  73. </p>
  74. <?php endif; ?>
  75. <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>
  76. <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
  77. <p>
  78. <label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
  79. <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() ); ?> />
  80. </p>
  81. <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
  82. <?php endif; ?>
  83. <?php if ( ! bbp_is_single_forum() ) : ?>
  84. <input type="hidden" name="bbp_forum_id" value="<?php echo bbp_get_form_topic_forum(); ?>" />
  85. <?php endif; ?>
  86. <?php if ( current_user_can( 'moderate' ) ) : ?>
  87. <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
  88. <p>
  89. <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
  90. <?php bbp_form_topic_type_dropdown(); ?>
  91. </p>
  92. <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
  93. <?php do_action( 'bbp_theme_before_topic_form_status' ); ?>
  94. <p>
  95. <label for="bbp_topic_status"><?php _e( 'Topic Status:', 'bbpress' ); ?></label><br />
  96. <?php bbp_form_topic_status_dropdown(); ?>
  97. </p>
  98. <?php do_action( 'bbp_theme_after_topic_form_status' ); ?>
  99. <?php endif; ?>
  100. <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_topic_edit() || ( bbp_is_topic_edit() && ! bbp_is_topic_anonymous() ) ) ) : ?>
  101. <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
  102. <p>
  103. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
  104. <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
  105. <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
  106. <?php else : ?>
  107. <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
  108. <?php endif; ?>
  109. </p>
  110. <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
  111. <?php endif; ?>
  112. <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
  113. <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
  114. <fieldset class="bbp-form">
  115. <legend>
  116. <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(); ?>" />
  117. <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
  118. </legend>
  119. <div>
  120. <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
  121. <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" />
  122. </div>
  123. </fieldset>
  124. <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
  125. <?php endif; ?>
  126. </div>
  127. </div>
  128. </div>
  129. <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
  130. <div class="bbp-submit-wrapper">
  131. <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
  132. <?php if ( ! bbp_is_topic_edit() ) : ?>
  133. <div class="notify-group-members-ui">
  134. <?php openlab_notify_group_members_ui( true ); ?>
  135. </div>
  136. <?php endif; ?>
  137. <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="btn btn-primary submit"><?php esc_html_e( 'Submit', 'bbpress' ); ?></button>
  138. <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
  139. </div>
  140. <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
  141. <?php bbp_topic_form_fields(); ?>
  142. <?php do_action( 'bbp_theme_after_topic_form' ); ?>
  143. </form>
  144. </div>
  145. <?php elseif ( bbp_is_forum_closed() ) : ?>
  146. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
  147. <div class="bbp-template-notice">
  148. <p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
  149. </div>
  150. </div>
  151. <?php else : ?>
  152. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
  153. <div class="bbp-template-notice">
  154. <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>
  155. </div>
  156. </div>
  157. <?php endif; ?>
  158. <?php if ( ! bbp_is_single_forum() ) : ?>
  159. </div>
  160. <?php endif; ?>