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

https://gitlab.com/woxiprogrammers/infinia-wordpress · PHP · 228 lines · 132 code · 89 blank · 7 comment · 22 complexity · cdcb7187425f6b11b4b6de261cf351b7 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 endif; ?>
  12. <?php if ( bbp_is_topic_edit() ) : ?>
  13. <?php bbp_topic_tag_list( bbp_get_topic_id(), array( 'before' => '<div class="bbp-topic-tags"><p>' . esc_html__( 'Tags:', 'Avada' ) . '&nbsp;', sep => ' ' ) ); ?>
  14. <?php endif; ?>
  15. <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
  16. <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
  17. <form id="new-post" name="new-post" method="post" action="<?php the_permalink(); ?>">
  18. <?php do_action( 'bbp_theme_before_topic_form' ); ?>
  19. <fieldset class="bbp-form">
  20. <legend>
  21. <?php
  22. if ( bbp_is_topic_edit() )
  23. printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
  24. else
  25. bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
  26. ?>
  27. </legend>
  28. <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
  29. <div>
  30. <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
  31. <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
  32. <p>
  33. <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
  34. <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(); ?>" />
  35. </p>
  36. <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
  37. <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
  38. <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
  39. <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
  40. <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
  41. <p class="form-allowed-tags">
  42. <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
  43. <code><?php bbp_allowed_tags(); ?></code>
  44. </p>
  45. <?php endif; ?>
  46. <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>
  47. <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
  48. <p>
  49. <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br />
  50. <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() ); ?> />
  51. </p>
  52. <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
  53. <?php endif; ?>
  54. <?php if ( !bbp_is_single_forum() ) : ?>
  55. <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
  56. <p>
  57. <label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
  58. <?php
  59. bbp_dropdown( array(
  60. 'show_none' => __( '(No Forum)', 'bbpress' ),
  61. 'selected' => bbp_get_form_topic_forum()
  62. ) );
  63. ?>
  64. </p>
  65. <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
  66. <?php endif; ?>
  67. <?php if ( current_user_can( 'moderate' ) ) : ?>
  68. <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
  69. <p>
  70. <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
  71. <?php bbp_form_topic_type_dropdown(); ?>
  72. </p>
  73. <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
  74. <?php do_action( 'bbp_theme_before_topic_form_status' ); ?>
  75. <p>
  76. <label for="bbp_topic_status"><?php _e( 'Topic Status:', 'bbpress' ); ?></label><br />
  77. <?php bbp_form_topic_status_dropdown(); ?>
  78. </p>
  79. <?php do_action( 'bbp_theme_after_topic_form_status' ); ?>
  80. <?php endif; ?>
  81. <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
  82. <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
  83. <fieldset class="bbp-form">
  84. <legend>
  85. <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(); ?>" />
  86. <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
  87. </legend>
  88. <div>
  89. <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
  90. <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" />
  91. </div>
  92. </fieldset>
  93. <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
  94. <?php endif; ?>
  95. <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
  96. <div class="bbp-submit-wrapper">
  97. <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
  98. <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="fusion-button button-default button-small submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
  99. <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
  100. </div>
  101. <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
  102. <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
  103. <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
  104. <div class="notify">
  105. <p>
  106. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
  107. <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
  108. <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
  109. <?php else : ?>
  110. <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
  111. <?php endif; ?>
  112. </p>
  113. </div>
  114. <div calss="clearfix"></div>
  115. <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
  116. <?php endif; ?>
  117. </div>
  118. <?php bbp_topic_form_fields(); ?>
  119. </fieldset>
  120. <?php do_action( 'bbp_theme_after_topic_form' ); ?>
  121. </form>
  122. </div>
  123. <?php elseif ( bbp_is_forum_closed() ) : ?>
  124. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
  125. <div class="bbp-template-notice">
  126. <p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
  127. </div>
  128. </div>
  129. <?php else : ?>
  130. <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
  131. <div class="bbp-template-notice">
  132. <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>
  133. </div>
  134. </div>
  135. <?php endif; ?>
  136. <?php if ( !bbp_is_single_forum() ) : ?>
  137. </div>
  138. <?php endif;
  139. // Omit closing PHP tag to avoid "Headers already sent" issues.