Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/28/2011 07:37:22 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Audit the bbp-twentyten theme's actions, HTML, and CSS. See #1702.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-topic.php

    r3586 r3651  
    1010?>
    1111
    12     <?php if ( !bbp_is_single_forum() ) : ?>
    13 
    14         <?php bbp_breadcrumb(); ?>
    15 
    16     <?php endif; ?>
    17 
    18     <?php if ( bbp_is_topic_edit() ) : ?>
    19 
    20         <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
    21 
    22         <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
    23 
    24     <?php endif; ?>
    25 
    26     <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
    27 
    28         <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
    29 
    30             <form id="new-post" name="new-post" method="post" action="">
    31 
    32                 <?php do_action( 'bbp_theme_before_topic_form' ); ?>
    33 
    34                 <fieldset class="bbp-form">
    35                     <legend>
    36 
    37                         <?php
    38                             if ( bbp_is_topic_edit() )
    39                                 printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
    40                             else
    41                                 bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
    42                         ?>
    43 
    44                     </legend>
    45 
    46                     <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
    47 
    48                     <?php if ( !bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
    49 
    50                         <div class="bbp-template-notice">
    51                             <p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
    52                         </div>
    53 
    54                     <?php endif; ?>
    55 
    56                     <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
    57 
    58                         <div class="bbp-template-notice">
    59                             <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
    60                         </div>
    61 
    62                     <?php endif; ?>
    63 
    64                     <?php do_action( 'bbp_template_notices' ); ?>
    65 
    66                     <div>
    67 
    68                         <?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?>
    69 
    70                         <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
    71 
    72                         <p>
    73                             <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
    74                             <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(); ?>" />
    75                         </p>
    76 
    77                         <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
    78 
    79                         <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
    80 
    81                         <?php if ( !function_exists( 'wp_editor' ) ) : ?>
    82 
    83                             <p>
    84                                 <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br />
    85                                 <textarea id="bbp_topic_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_topic_content" cols="60" rows="6"><?php bbp_form_topic_content(); ?></textarea>
    86                             </p>
    87 
    88                         <?php else : ?>
    89 
    90                             <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
    91                            
    92                         <?php endif; ?>
    93 
    94                         <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
    95 
    96                         <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?>
    97 
    98                             <p class="form-allowed-tags">
    99                                 <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
    100                                 <code><?php bbp_allowed_tags(); ?></code>
    101                             </p>
    102 
    103                         <?php endif; ?>
    104 
    105                         <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
    106 
    107                         <p>
    108                             <label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
    109                             <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() ); ?> />
    110                         </p>
    111 
    112                         <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
    113 
    114                         <?php if ( !bbp_is_single_forum() ) : ?>
    115 
    116                             <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
    117 
    118                             <p>
    119                                 <label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
    120                                 <?php bbp_dropdown( array( 'selected' => bbp_get_form_topic_forum() ) ); ?>
    121                             </p>
    122 
    123                             <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
    124 
    125                         <?php endif; ?>
    126 
    127                         <?php if ( current_user_can( 'moderate' ) ) : ?>
    128 
    129                             <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
    130 
    131                             <p>
    132 
    133                                 <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
    134 
    135                                 <?php bbp_topic_type_select(); ?>
    136 
    137                             </p>
    138 
    139                             <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
    140 
    141                         <?php endif; ?>
    142 
    143                         <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
    144 
    145                             <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
    146 
    147                             <p>
    148                                 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
    149 
    150                                 <?php if ( bbp_is_topic_edit() && ( $post->post_author != bbp_get_current_user_id() ) ) : ?>
    151 
    152                                     <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
    153 
    154                                 <?php else : ?>
    155 
    156                                     <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
    157 
    158                                 <?php endif; ?>
    159                             </p>
    160 
    161                             <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
    162 
    163                         <?php endif; ?>
    164 
    165                         <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
    166 
    167                             <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
    168 
    169                             <fieldset class="bbp-form">
    170                                 <legend><?php _e( 'Revision', 'bbpress' ); ?></legend>
    171                                 <div>
    172                                     <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(); ?>" />
    173                                     <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
    174                                 </div>
    175 
    176                                 <div>
    177                                     <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
    178                                     <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" />
    179                                 </div>
    180                             </fieldset>
    181 
    182                             <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
    183 
    184                         <?php endif; ?>
    185 
    186                         <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
    187 
    188                         <div class="bbp-submit-wrapper">
    189 
    190                             <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
    191 
    192                             <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
    193 
    194                             <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
    195 
    196                         </div>
    197 
    198                         <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
    199 
     12<?php if ( !bbp_is_single_forum() ) : ?>
     13
     14<div id="bbpress-forums">
     15
     16    <?php bbp_breadcrumb(); ?>
     17
     18<?php endif; ?>
     19
     20<?php if ( bbp_is_topic_edit() ) : ?>
     21
     22    <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
     23
     24    <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
     25
     26<?php endif; ?>
     27
     28<?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
     29
     30    <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
     31
     32        <form id="new-post" name="new-post" method="post" action="">
     33
     34            <?php do_action( 'bbp_theme_before_topic_form' ); ?>
     35
     36            <fieldset class="bbp-form">
     37                <legend>
     38
     39                    <?php
     40                        if ( bbp_is_topic_edit() )
     41                            printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
     42                        else
     43                            bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
     44                    ?>
     45
     46                </legend>
     47
     48                <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
     49
     50                <?php if ( !bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
     51
     52                    <div class="bbp-template-notice">
     53                        <p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
    20054                    </div>
    20155
    202                     <?php bbp_topic_form_fields(); ?>
    203 
    204                 </fieldset>
    205 
    206                 <?php do_action( 'bbp_theme_after_topic_form' ); ?>
    207 
    208             </form>
     56                <?php endif; ?>
     57
     58                <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
     59
     60                    <div class="bbp-template-notice">
     61                        <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
     62                    </div>
     63
     64                <?php endif; ?>
     65
     66                <?php do_action( 'bbp_template_notices' ); ?>
     67
     68                <div>
     69
     70                    <?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?>
     71
     72                    <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
     73
     74                    <p>
     75                        <label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
     76                        <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(); ?>" />
     77                    </p>
     78
     79                    <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
     80
     81                    <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
     82
     83                    <?php if ( !function_exists( 'wp_editor' ) ) : ?>
     84
     85                        <p>
     86                            <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br />
     87                            <textarea id="bbp_topic_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_topic_content" cols="60" rows="6"><?php bbp_form_topic_content(); ?></textarea>
     88                        </p>
     89
     90                    <?php else : ?>
     91
     92                        <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
     93
     94                    <?php endif; ?>
     95
     96                    <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
     97
     98                    <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?>
     99
     100                        <p class="form-allowed-tags">
     101                            <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
     102                            <code><?php bbp_allowed_tags(); ?></code>
     103                        </p>
     104
     105                    <?php endif; ?>
     106
     107                    <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
     108
     109                    <p>
     110                        <label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
     111                        <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() ); ?> />
     112                    </p>
     113
     114                    <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
     115
     116                    <?php if ( !bbp_is_single_forum() ) : ?>
     117
     118                        <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
     119
     120                        <p>
     121                            <label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
     122                            <?php bbp_dropdown( array( 'selected' => bbp_get_form_topic_forum() ) ); ?>
     123                        </p>
     124
     125                        <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
     126
     127                    <?php endif; ?>
     128
     129                    <?php if ( current_user_can( 'moderate' ) ) : ?>
     130
     131                        <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
     132
     133                        <p>
     134
     135                            <label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
     136
     137                            <?php bbp_topic_type_select(); ?>
     138
     139                        </p>
     140
     141                        <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
     142
     143                    <?php endif; ?>
     144
     145                    <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
     146
     147                        <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
     148
     149                        <p>
     150                            <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
     151
     152                            <?php if ( bbp_is_topic_edit() && ( $post->post_author != bbp_get_current_user_id() ) ) : ?>
     153
     154                                <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
     155
     156                            <?php else : ?>
     157
     158                                <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
     159
     160                            <?php endif; ?>
     161                        </p>
     162
     163                        <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
     164
     165                    <?php endif; ?>
     166
     167                    <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
     168
     169                        <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
     170
     171                        <fieldset class="bbp-form">
     172                            <legend><?php _e( 'Revision', 'bbpress' ); ?></legend>
     173                            <div>
     174                                <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(); ?>" />
     175                                <label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
     176                            </div>
     177
     178                            <div>
     179                                <label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
     180                                <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" />
     181                            </div>
     182                        </fieldset>
     183
     184                        <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
     185
     186                    <?php endif; ?>
     187
     188                    <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
     189
     190                    <div class="bbp-submit-wrapper">
     191
     192                        <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
     193
     194                        <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
     195
     196                        <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
     197
     198                    </div>
     199
     200                    <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
     201
     202                </div>
     203
     204                <?php bbp_topic_form_fields(); ?>
     205
     206            </fieldset>
     207
     208            <?php do_action( 'bbp_theme_after_topic_form' ); ?>
     209
     210        </form>
     211    </div>
     212
     213<?php elseif ( bbp_is_forum_closed() ) : ?>
     214
     215    <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
     216        <div class="bbp-template-notice">
     217            <p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
    209218        </div>
    210 
    211     <?php elseif ( bbp_is_forum_closed() ) : ?>
    212 
    213         <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
    214             <div class="bbp-template-notice">
    215                 <p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
    216             </div>
     219    </div>
     220
     221<?php else : ?>
     222
     223    <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
     224        <div class="bbp-template-notice">
     225            <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>
    217226        </div>
    218 
    219     <?php else : ?>
    220 
    221         <div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
    222             <div class="bbp-template-notice">
    223                 <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>
    224             </div>
    225         </div>
    226 
    227     <?php endif; ?>
     227    </div>
     228
     229<?php endif; ?>
     230
     231<?php if ( !bbp_is_single_forum() ) : ?>
     232
     233</div>
     234
     235<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.