PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/skeleton/bbpress/form-topic.php

https://github.com/gellybeans/skeleton_wp
PHP | 219 lines | 129 code | 84 blank | 6 comment | 22 complexity | 440f69909eb4ff140eb406e2887d8374 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. * New/Edit Topic
  4. *
  5. * @package bbPress
  6. * @subpackage Theme
  7. */
  8. ?>
  9. <?php if ( !bbp_is_single_forum() ) : ?>
  10. <?php bbp_breadcrumb(); ?>
  11. <?php endif; ?>
  12. <?php if ( bbp_is_topic_edit() ) : ?>
  13. <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
  14. <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
  15. <?php endif; ?>
  16. <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
  17. <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
  18. <form id="new-post" name="new-post" method="post" action="">
  19. <?php do_action( 'bbp_theme_before_topic_form' ); ?>
  20. <fieldset class="bbp-form">
  21. <legend>
  22. <?php
  23. if ( bbp_is_topic_edit() )
  24. printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
  25. else
  26. bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
  27. ?>
  28. </legend>
  29. <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
  30. <?php if ( !bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
  31. <div class="bbp-template-notice">
  32. <p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
  33. </div>
  34. <?php endif; ?>
  35. <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
  36. <div class="bbp-template-notice">
  37. <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
  38. </div>
  39. <?php endif; ?>
  40. <?php do_action( 'bbp_template_notices' ); ?>
  41. <div>
  42. <?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?>
  43. <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
  44. <p>
  45. <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
  46. <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(); ?>" />
  47. </p>
  48. <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
  49. <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
  50. <p>
  51. <label for="bbp_topic_content"><?php _e( 'Topic Description:', 'bbpress' ); ?></label><br />
  52. <textarea id="bbp_topic_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_topic_content" cols="60" rows="6"><?php bbp_form_topic_content(); ?></textarea>
  53. </p>
  54. <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
  55. <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?>
  56. <p class="form-allowed-tags">
  57. <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
  58. <code><?php bbp_allowed_tags(); ?></code>
  59. </p>
  60. <?php endif; ?>
  61. <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
  62. <p>
  63. <label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
  64. <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() ); ?> />
  65. </p>
  66. <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
  67. <?php if ( !bbp_is_single_forum() ) : ?>
  68. <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
  69. <p>
  70. <label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
  71. <?php bbp_dropdown( array( 'selected' => bbp_get_form_topic_forum() ) ); ?>
  72. </p>
  73. <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
  74. <?php endif; ?>
  75. <?php if ( current_user_can( 'moderate' ) ) : ?>
  76. <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
  77. <p>
  78. <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
  79. <?php bbp_topic_type_select(); ?>
  80. </p>
  81. <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
  82. <?php endif; ?>
  83. <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
  84. <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
  85. <p>
  86. <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
  87. <?php if ( bbp_is_topic_edit() && ( $post->post_author != bbp_get_current_user_id() ) ) : ?>
  88. <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
  89. <?php else : ?>
  90. <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
  91. <?php endif; ?>
  92. </p>
  93. <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
  94. <?php endif; ?>
  95. <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
  96. <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
  97. <fieldset class="bbp-form">
  98. <legend><?php _e( 'Revision', 'bbpress' ); ?></legend>
  99. <div>
  100. <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(); ?>" />
  101. <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
  102. </div>
  103. <div>
  104. <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
  105. <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" />
  106. </div>
  107. </fieldset>
  108. <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
  109. <?php endif; ?>
  110. <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
  111. <div class="bbp-submit-wrapper">
  112. <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
  113. <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
  114. <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
  115. </div>
  116. <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
  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 at this time.', 'bbpress' ) : _e( 'You must be logged in to create new topics.', 'bbpress' ); ?></p>
  133. </div>
  134. </div>
  135. <?php endif; ?>