/bbpress/form-reply.php

https://bitbucket.org/travelertech/tt-main · PHP · 194 lines · 112 code · 76 blank · 6 comment · 23 complexity · 42dc5ef8362135bb88674acd37a1282a MD5 · raw file

  1. <?php
  2. /**
  3. * New/Edit Reply
  4. *
  5. * @package bbPress
  6. * @subpackage Theme
  7. */
  8. ?>
  9. <?php if ( bbp_is_reply_edit() ) : ?>
  10. <div id="bbpress-forums">
  11. <?php bbp_breadcrumb(); ?>
  12. <?php endif; ?>
  13. <?php if ( bbp_current_user_can_access_create_reply_form() ) : ?>
  14. <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form">
  15. <form id="new-post" name="new-post" method="post" action="<?php the_permalink(); ?>">
  16. <?php do_action( 'bbp_theme_before_reply_form' ); ?>
  17. <fieldset class="bbp-form">
  18. <legend><?php printf( __( 'Reply To: %s', 'bbpress' ), bbp_get_topic_title() ); ?></legend>
  19. <?php do_action( 'bbp_theme_before_reply_form_notices' ); ?>
  20. <?php if ( !bbp_is_topic_open() && !bbp_is_reply_edit() ) : ?>
  21. <div class="bbp-template-notice">
  22. <p><?php _e( 'This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
  23. </div>
  24. <?php endif; ?>
  25. <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
  26. <div class="bbp-template-notice">
  27. <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
  28. </div>
  29. <?php endif; ?>
  30. <?php do_action( 'bbp_template_notices' ); ?>
  31. <div>
  32. <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
  33. <?php do_action( 'bbp_theme_before_reply_form_content' ); ?>
  34. <?php if ( !function_exists( 'wp_editor' ) ) : ?>
  35. <p>
  36. <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br />
  37. <textarea id="bbp_reply_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_reply_content" rows="6"><?php bbp_form_reply_content(); ?></textarea>
  38. </p>
  39. <?php else : ?>
  40. <?php bbp_the_content( array( 'context' => 'reply' ) ); ?>
  41. <?php endif; ?>
  42. <?php do_action( 'bbp_theme_after_reply_form_content' ); ?>
  43. <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?>
  44. <p class="form-allowed-tags">
  45. <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
  46. <code><?php bbp_allowed_tags(); ?></code>
  47. </p>
  48. <?php endif; ?>
  49. <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>
  50. <?php do_action( 'bbp_theme_before_reply_form_tags' ); ?>
  51. <p>
  52. <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br />
  53. <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() ); ?> />
  54. </p>
  55. <?php do_action( 'bbp_theme_after_reply_form_tags' ); ?>
  56. <?php endif; ?>
  57. <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_reply_edit() || ( bbp_is_reply_edit() && !bbp_is_reply_anonymous() ) ) ) : ?>
  58. <?php do_action( 'bbp_theme_before_reply_form_subscription' ); ?>
  59. <p>
  60. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
  61. <?php if ( bbp_is_reply_edit() && ( get_the_author_meta( 'ID' ) != bbp_get_current_user_id() ) ) : ?>
  62. <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
  63. <?php else : ?>
  64. <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
  65. <?php endif; ?>
  66. </p>
  67. <?php do_action( 'bbp_theme_after_reply_form_subscription' ); ?>
  68. <?php endif; ?>
  69. <?php if ( bbp_allow_revisions() && bbp_is_reply_edit() ) : ?>
  70. <?php do_action( 'bbp_theme_before_reply_form_revisions' ); ?>
  71. <fieldset class="bbp-form">
  72. <legend><?php _e( 'Revision', 'bbpress' ); ?></legend>
  73. <div>
  74. <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" />
  75. <label for="bbp_log_reply_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
  76. </div>
  77. <div>
  78. <label for="bbp_reply_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
  79. <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" />
  80. </div>
  81. </fieldset>
  82. <?php do_action( 'bbp_theme_after_reply_form_revisions' ); ?>
  83. <?php endif; ?>
  84. <?php do_action( 'bbp_theme_before_reply_form_submit_wrapper' ); ?>
  85. <div class="bbp-submit-wrapper">
  86. <?php do_action( 'bbp_theme_before_reply_form_submit_button' ); ?>
  87. <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_reply_submit" name="bbp_reply_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
  88. <?php do_action( 'bbp_theme_after_reply_form_submit_button' ); ?>
  89. </div>
  90. <?php do_action( 'bbp_theme_after_reply_form_submit_wrapper' ); ?>
  91. </div>
  92. <?php bbp_reply_form_fields(); ?>
  93. </fieldset>
  94. <?php do_action( 'bbp_theme_after_reply_form' ); ?>
  95. </form>
  96. </div>
  97. <?php elseif ( bbp_is_topic_closed() ) : ?>
  98. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  99. <div class="bbp-template-notice">
  100. <p><?php printf( __( 'The topic &#8216;%s&#8217; is closed to new replies.', 'bbpress' ), bbp_get_topic_title() ); ?></p>
  101. </div>
  102. </div>
  103. <?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
  104. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  105. <div class="bbp-template-notice">
  106. <p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></p>
  107. </div>
  108. </div>
  109. <?php else : ?>
  110. <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
  111. <div class="bbp-template-notice">
  112. <p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?></p>
  113. </div>
  114. </div>
  115. <?php endif; ?>
  116. <?php if ( bbp_is_reply_edit() ) : ?>
  117. </div>
  118. <?php endif; ?>