Skip to:
Content

bbPress.org

Changeset 3624


Ignore:
Timestamp:
11/20/2011 09:39:16 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Add topic sticky dropdown to wp-admin metabox. Fixes #1625. Props GautamGupta.

Location:
branches/plugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-metaboxes.php

    r3623 r3624  
    338338    </p>
    339339
     340    <p><strong><?php _e( 'Topic Type', 'bbpress' ); ?></strong></p>
     341
     342    <p>
     343        <label class="screen-reader-text" for="bbp_stick_topic"><?php _e( 'Topic Type', 'bbpress' ); ?></label>
     344        <?php bbp_topic_type_select( array( 'topic_id' => $post->ID ) ); ?>
     345    </p>
     346
    340347    <?php
    341348
  • branches/plugin/bbp-admin/bbp-topics.php

    r3583 r3624  
    118118        $bbp_contextual_help[] = __( '<strong>Title</strong> - Enter a title for your topic. After you enter a title, you will see the permalink below, which you can edit.', 'bbpress' );
    119119        $bbp_contextual_help[] = __( '<strong>Post editor</strong> - Enter the text for your topic. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The screen icon just before that allows you to expand the edit box to full screen. The HTML mode allows you to enter raw HTML along with your forum text. You can insert media files by clicking the icons above the post editor and following the directions.', 'bbpress' );
    120         $bbp_contextual_help[] = __( '<strong>Topic Attributes</strong> - Select the attributes that your topic should have. The Forum dropdown determines the parent forum that the topic belongs to. Select the forum or category from the dropdown, or leave the default (No Forum) to post the topic without an assigned forum.', 'bbpress' );
     120        $bbp_contextual_help[] = __( '<strong>Topic Attributes</strong> - Select the attributes that your topic should have. The Forum dropdown determines the parent forum that the topic belongs to. Select the forum or category from the dropdown, or leave the default (No Forum) to post the topic without an assigned forum. The topic type drop down indicates the sticky status of the topic. Selecting the super sticky option would stick the topic to the front of your forums, i.e. the topic index, sticky option would stick the topic to its respective forum. Selecting normal would not stick the topic anywhere.', 'bbpress' );
    121121        $bbp_contextual_help[] = __( '<strong>Publish</strong> - The Publish box will allow you to save your topic as Draft or Pending Review. You may Preview your topic before it is published as well. The Visibility will determine whether the topic is Public, Password protected (requiring a password on the site to view) or Private (only the author will have access to it). Topics may be published immediately by clicking the dropdown, or at a specific date and time by clicking the Edit link.', 'bbpress' );
    122122        $bbp_contextual_help[] = __( '<strong>Topic Tags</strong> - You can assign keywords to your topics using Topic Tags. Unlike categories, tags have no hierarchy, meaning there is no relationship from one tag to another. Topics can be added and modified further from the Topic Tags screen.', 'bbpress' );
     
    142142        /** Post Rows *********************************************************/
    143143
    144         $bbp_contextual_help[] = __( 'This screen displays the topics created on your site.',           'bbpress' );
     144        $bbp_contextual_help[] = __( 'This screen displays the topics created on your site.',             'bbpress' );
    145145        $bbp_contextual_help[] = __( 'You can customize the display of this screen in a number of ways:', 'bbpress' );
    146146        $bbp_contextual_help[] =
     
    263263        // Formally update the topic
    264264        bbp_update_topic( $topic_id, $forum_id );
     265
     266        // Stickies
     267        if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
     268
     269            // What's the haps?
     270            switch ( $_POST['bbp_stick_topic'] ) {
     271
     272                // Sticky in this forum
     273                case 'stick'   :
     274                    bbp_stick_topic( $topic_id );
     275                    break;
     276
     277                // Super sticky in all forums
     278                case 'super'   :
     279                    bbp_stick_topic( $topic_id, true );
     280                    break;
     281
     282                // Normal
     283                case 'unstick' :
     284                default        :
     285                    bbp_unstick_topic( $topic_id );
     286                    break;
     287            }
     288        }
    265289
    266290        // Allow other fun things to happen
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3621 r3624  
    26202620 *  - topic_id: Topic id
    26212621 * @uses bbp_get_topic_id() To get the topic id
     2622 * @uses bbp_is_single_topic() To check if we're viewing a single topic
    26222623 * @uses bbp_is_topic_edit() To check if it is the topic edit page
    26232624 * @uses bbp_is_topic_super_sticky() To check if the topic is a super sticky
     
    26382639    extract( $r );
    26392640
    2640     // Get current topic id
    2641     $topic_id = bbp_get_topic_id( $topic_id );
    2642 
    26432641    // Edit topic
    2644     if ( bbp_is_topic_edit() ) {
     2642    if ( bbp_is_single_topic() || bbp_is_topic_edit() ) {
     2643
     2644        // Get current topic id
     2645        $topic_id = bbp_get_topic_id( $topic_id );
    26452646
    26462647        // Post value is passed
Note: See TracChangeset for help on using the changeset viewer.