[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

/src/templates/default/bbpress/ -> form-topic.php (source)

   1  <?php
   2  
   3  /**
   4   * New/Edit Topic
   5   *
   6   * @package bbPress
   7   * @subpackage Theme
   8   */
   9  
  10  // Exit if accessed directly
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  if ( ! bbp_is_single_forum() ) : ?>
  14  
  15  <div id="bbpress-forums" class="bbpress-wrapper">
  16  
  17      <?php bbp_breadcrumb(); ?>
  18  
  19  <?php endif; ?>
  20  
  21  <?php if ( bbp_is_topic_edit() ) : ?>
  22  
  23      <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
  24  
  25      <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
  26  
  27      <?php bbp_get_template_part( 'alert', 'topic-lock' ); ?>
  28  
  29  <?php endif; ?>
  30  
  31  <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
  32  
  33      <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
  34  
  35          <form id="new-post" name="new-post" method="post">
  36  
  37              <?php do_action( 'bbp_theme_before_topic_form' ); ?>
  38  
  39              <fieldset class="bbp-form">
  40                  <legend>
  41  
  42                      <?php
  43                          if ( bbp_is_topic_edit() ) :
  44                              printf( esc_html__( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
  45                          else :
  46                              ( bbp_is_single_forum() && bbp_get_forum_title() )
  47                                  ? printf( esc_html__( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() )
  48                                  : esc_html_e( 'Create New Topic', 'bbpress' );
  49                          endif;
  50                      ?>
  51  
  52                  </legend>
  53  
  54                  <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
  55  
  56                  <?php if ( ! bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
  57  
  58                      <div class="bbp-template-notice">
  59                          <ul>
  60                              <li><?php esc_html_e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to create a topic.', 'bbpress' ); ?></li>
  61                          </ul>
  62                      </div>
  63  
  64                  <?php endif; ?>
  65  
  66                  <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
  67  
  68                      <div class="bbp-template-notice">
  69                          <ul>
  70                              <li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></li>
  71                          </ul>
  72                      </div>
  73  
  74                  <?php endif; ?>
  75  
  76                  <?php do_action( 'bbp_template_notices' ); ?>
  77  
  78                  <div>
  79  
  80                      <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
  81  
  82                      <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
  83  
  84                      <p>
  85                          <label for="bbp_topic_title"><?php printf( esc_html__( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
  86                          <input type="text" id="bbp_topic_title" value="<?php bbp_form_topic_title(); ?>" size="40" name="bbp_topic_title" maxlength="<?php bbp_title_max_length(); ?>" />
  87                      </p>
  88  
  89                      <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
  90  
  91                      <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
  92  
  93                      <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
  94  
  95                      <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
  96  
  97                      <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
  98  
  99                          <p class="form-allowed-tags">
 100                              <label><?php printf( esc_html__( 'You may use these %s tags and attributes:', 'bbpress' ), '<abbr title="HyperText Markup Language">HTML</abbr>' ); ?></label><br />
 101                              <code><?php bbp_allowed_tags(); ?></code>
 102                          </p>
 103  
 104                      <?php endif; ?>
 105  
 106                      <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
 107  
 108                          <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
 109  
 110                          <p>
 111                              <label for="bbp_topic_tags"><?php esc_html_e( 'Topic Tags:', 'bbpress' ); ?></label><br />
 112                              <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() ); ?> />
 113                          </p>
 114  
 115                          <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
 116  
 117                      <?php endif; ?>
 118  
 119                      <?php if ( ! bbp_is_single_forum() ) : ?>
 120  
 121                          <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
 122  
 123                          <p>
 124                              <label for="bbp_forum_id"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></label><br />
 125                              <?php
 126                                  bbp_dropdown( array(
 127                                      'show_none' => esc_html__( '&mdash; No forum &mdash;', 'bbpress' ),
 128                                      'selected'  => bbp_get_form_topic_forum()
 129                                  ) );
 130                              ?>
 131                          </p>
 132  
 133                          <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
 134  
 135                      <?php endif; ?>
 136  
 137                      <?php if ( current_user_can( 'moderate', bbp_get_topic_id() ) ) : ?>
 138  
 139                          <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
 140  
 141                          <p>
 142  
 143                              <label for="bbp_stick_topic"><?php esc_html_e( 'Topic Type:', 'bbpress' ); ?></label><br />
 144  
 145                              <?php bbp_form_topic_type_dropdown(); ?>
 146  
 147                          </p>
 148  
 149                          <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
 150  
 151                          <?php do_action( 'bbp_theme_before_topic_form_status' ); ?>
 152  
 153                          <p>
 154  
 155                              <label for="bbp_topic_status"><?php esc_html_e( 'Topic Status:', 'bbpress' ); ?></label><br />
 156  
 157                              <?php bbp_form_topic_status_dropdown(); ?>
 158  
 159                          </p>
 160  
 161                          <?php do_action( 'bbp_theme_after_topic_form_status' ); ?>
 162  
 163                      <?php endif; ?>
 164  
 165                      <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_topic_edit() || ( bbp_is_topic_edit() && ! bbp_is_topic_anonymous() ) ) ) : ?>
 166  
 167                          <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
 168  
 169                          <p>
 170                              <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> />
 171  
 172                              <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
 173  
 174                                  <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
 175  
 176                              <?php else : ?>
 177  
 178                                  <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
 179  
 180                              <?php endif; ?>
 181                          </p>
 182  
 183                          <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
 184  
 185                      <?php endif; ?>
 186  
 187                      <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
 188  
 189                          <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
 190  
 191                          <fieldset class="bbp-form">
 192                              <legend>
 193                                  <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> />
 194                                  <label for="bbp_log_topic_edit"><?php esc_html_e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
 195                              </legend>
 196  
 197                              <div>
 198                                  <label for="bbp_topic_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
 199                                  <input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" size="40" name="bbp_topic_edit_reason" id="bbp_topic_edit_reason" />
 200                              </div>
 201                          </fieldset>
 202  
 203                          <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
 204  
 205                      <?php endif; ?>
 206  
 207                      <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
 208  
 209                      <div class="bbp-submit-wrapper">
 210  
 211                          <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
 212  
 213                          <button type="submit" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php esc_html_e( 'Submit', 'bbpress' ); ?></button>
 214  
 215                          <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
 216  
 217                      </div>
 218  
 219                      <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
 220  
 221                  </div>
 222  
 223                  <?php bbp_topic_form_fields(); ?>
 224  
 225              </fieldset>
 226  
 227              <?php do_action( 'bbp_theme_after_topic_form' ); ?>
 228  
 229          </form>
 230      </div>
 231  
 232  <?php elseif ( bbp_is_forum_closed() ) : ?>
 233  
 234      <div id="forum-closed-<?php bbp_forum_id(); ?>" class="bbp-forum-closed">
 235          <div class="bbp-template-notice">
 236              <ul>
 237                  <li><?php printf( esc_html__( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></li>
 238              </ul>
 239          </div>
 240      </div>
 241  
 242  <?php else : ?>
 243  
 244      <div id="no-topic-<?php bbp_forum_id(); ?>" class="bbp-no-topic">
 245          <div class="bbp-template-notice">
 246              <ul>
 247                  <li><?php is_user_logged_in()
 248                      ? esc_html_e( 'You cannot create new topics.',               'bbpress' )
 249                      : esc_html_e( 'You must be logged in to create new topics.', 'bbpress' );
 250                  ?></li>
 251              </ul>
 252          </div>
 253  
 254          <?php if ( ! is_user_logged_in() ) : ?>
 255  
 256              <?php bbp_get_template_part( 'form', 'user-login' ); ?>
 257  
 258          <?php endif; ?>
 259  
 260      </div>
 261  
 262  <?php endif; ?>
 263  
 264  <?php if ( ! bbp_is_single_forum() ) : ?>
 265  
 266  </div>
 267  
 268  <?php endif;


Generated: Wed Dec 11 01:01:26 2019 Cross-referenced by PHPXref 0.7.1