/wp-content/plugins/bbpress/templates/default/bbpress/form-reply.php

https://github.com/livinglab/openlab · PHP · 241 lines · 144 code · 90 blank · 7 comment · 26 complexity · 0977cb762517194c2465a2b84cedbce9 MD5 · raw file

  1. <?php
  2. /**
  3. * New/Edit Reply
  4. *
  5. * @package bbPress
  6. * @subpackage Theme
  7. */
  8. // Exit if accessed directly
  9. defined( 'ABSPATH' ) || exit;
  10. if ( bbp_is_reply_edit() ) : ?>
  11. <div id="bbpress-forums" class="bbpress-wrapper">
  12. <?php bbp_breadcrumb(); ?>
  13. <?php endif; ?>
  14. <?php if ( bbp_current_user_can_access_create_reply_form() ) : ?>
  15. <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form">
  16. <form id="new-post" name="new-post" method="post">
  17. <?php do_action( 'bbp_theme_before_reply_form' ); ?>
  18. <fieldset class="bbp-form">
  19. <legend><?php printf( esc_html__( 'Reply To: %s', 'bbpress' ), ( bbp_get_form_reply_to() ) ? sprintf( esc_html__( 'Reply #%1$s in %2$s', 'bbpress' ), bbp_get_form_reply_to(), bbp_get_topic_title() ) : bbp_get_topic_title() ); ?></legend>
  20. <?php do_action( 'bbp_theme_before_reply_form_notices' ); ?>
  21. <?php if ( ! bbp_is_topic_open() && ! bbp_is_reply_edit() ) : ?>
  22. <div class="bbp-template-notice">
  23. <ul>
  24. <li><?php esc_html_e( 'This topic is marked as closed to new replies, however your posting capabilities still allow you to reply.', 'bbpress' ); ?></li>
  25. </ul>
  26. </div>
  27. <?php endif; ?>
  28. <?php if ( ! bbp_is_reply_edit() && bbp_is_forum_closed() ) : ?>
  29. <div class="bbp-template-notice">
  30. <ul>
  31. <li><?php esc_html_e( 'This forum is closed to new content, however your posting capabilities still allow you to post.', 'bbpress' ); ?></li>
  32. </ul>
  33. </div>
  34. <?php endif; ?>
  35. <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
  36. <div class="bbp-template-notice">
  37. <ul>
  38. <li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></li>
  39. </ul>
  40. </div>
  41. <?php endif; ?>
  42. <?php do_action( 'bbp_template_notices' ); ?>
  43. <div>
  44. <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
  45. <?php do_action( 'bbp_theme_before_reply_form_content' ); ?>
  46. <?php bbp_the_content( array( 'context' => 'reply' ) ); ?>
  47. <?php do_action( 'bbp_theme_after_reply_form_content' ); ?>
  48. <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
  49. <p class="form-allowed-tags">
  50. <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
  51. <code><?php bbp_allowed_tags(); ?></code>
  52. </p>
  53. <?php endif; ?>
  54. <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
  55. <?php do_action( 'bbp_theme_before_reply_form_tags' ); ?>
  56. <p>
  57. <label for="bbp_topic_tags"><?php esc_html_e( 'Tags:', 'bbpress' ); ?></label><br />
  58. <input type="text" value="<?php bbp_form_topic_tags(); ?>" size="40" name="bbp_topic_tags" id="bbp_topic_tags" <?php disabled( bbp_is_topic_spam() ); ?> />
  59. </p>
  60. <?php do_action( 'bbp_theme_after_reply_form_tags' ); ?>
  61. <?php endif; ?>
  62. <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_reply_edit() || ( bbp_is_reply_edit() && ! bbp_is_reply_anonymous() ) ) ) : ?>
  63. <?php do_action( 'bbp_theme_before_reply_form_subscription' ); ?>
  64. <p>
  65. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> />
  66. <?php if ( bbp_is_reply_edit() && ( bbp_get_reply_author_id() !== bbp_get_current_user_id() ) ) : ?>
  67. <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
  68. <?php else : ?>
  69. <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
  70. <?php endif; ?>
  71. </p>
  72. <?php do_action( 'bbp_theme_after_reply_form_subscription' ); ?>
  73. <?php endif; ?>
  74. <?php if ( bbp_is_reply_edit() ) : ?>
  75. <?php if ( current_user_can( 'moderate', bbp_get_reply_id() ) ) : ?>
  76. <?php do_action( 'bbp_theme_before_reply_form_reply_to' ); ?>
  77. <p class="form-reply-to">
  78. <label for="bbp_reply_to"><?php esc_html_e( 'Reply To:', 'bbpress' ); ?></label><br />
  79. <?php bbp_reply_to_dropdown(); ?>
  80. </p>
  81. <?php do_action( 'bbp_theme_after_reply_form_reply_to' ); ?>
  82. <?php do_action( 'bbp_theme_before_reply_form_status' ); ?>
  83. <p>
  84. <label for="bbp_reply_status"><?php esc_html_e( 'Reply Status:', 'bbpress' ); ?></label><br />
  85. <?php bbp_form_reply_status_dropdown(); ?>
  86. </p>
  87. <?php do_action( 'bbp_theme_after_reply_form_status' ); ?>
  88. <?php endif; ?>
  89. <?php if ( bbp_allow_revisions() ) : ?>
  90. <?php do_action( 'bbp_theme_before_reply_form_revisions' ); ?>
  91. <fieldset class="bbp-form">
  92. <legend>
  93. <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> />
  94. <label for="bbp_log_reply_edit"><?php esc_html_e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
  95. </legend>
  96. <div>
  97. <label for="bbp_reply_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
  98. <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" />
  99. </div>
  100. </fieldset>
  101. <?php do_action( 'bbp_theme_after_reply_form_revisions' ); ?>
  102. <?php endif; ?>
  103. <?php endif; ?>
  104. <?php do_action( 'bbp_theme_before_reply_form_submit_wrapper' ); ?>
  105. <div class="bbp-submit-wrapper">
  106. <?php do_action( 'bbp_theme_before_reply_form_submit_button' ); ?>
  107. <?php bbp_cancel_reply_to_link(); ?>
  108. <button type="submit" id="bbp_reply_submit" name="bbp_reply_submit" class="button submit"><?php esc_html_e( 'Submit', 'bbpress' ); ?></button>
  109. <?php do_action( 'bbp_theme_after_reply_form_submit_button' ); ?>
  110. </div>
  111. <?php do_action( 'bbp_theme_after_reply_form_submit_wrapper' ); ?>
  112. </div>
  113. <?php bbp_reply_form_fields(); ?>
  114. </fieldset>
  115. <?php do_action( 'bbp_theme_after_reply_form' ); ?>
  116. </form>
  117. </div>
  118. <?php elseif ( bbp_is_topic_closed() ) : ?>
  119. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  120. <div class="bbp-template-notice">
  121. <ul>
  122. <li><?php printf( esc_html__( 'The topic &#8216;%s&#8217; is closed to new replies.', 'bbpress' ), bbp_get_topic_title() ); ?></li>
  123. </ul>
  124. </div>
  125. </div>
  126. <?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
  127. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  128. <div class="bbp-template-notice">
  129. <ul>
  130. <li><?php printf( esc_html__( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></li>
  131. </ul>
  132. </div>
  133. </div>
  134. <?php else : ?>
  135. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  136. <div class="bbp-template-notice">
  137. <ul>
  138. <li><?php is_user_logged_in()
  139. ? esc_html_e( 'You cannot reply to this topic.', 'bbpress' )
  140. : esc_html_e( 'You must be logged in to reply to this topic.', 'bbpress' );
  141. ?></li>
  142. </ul>
  143. </div>
  144. <?php if ( ! is_user_logged_in() ) : ?>
  145. <?php bbp_get_template_part( 'form', 'user-login' ); ?>
  146. <?php endif; ?>
  147. </div>
  148. <?php endif; ?>
  149. <?php if ( bbp_is_reply_edit() ) : ?>
  150. </div>
  151. <?php endif;