Skip to:
Content

bbPress.org

Ticket #2275: metaboxes.php.patch

File metaboxes.php.patch, 2.4 KB (added by MZAWeb, 12 years ago)
  • includes/admin/metaboxes.php

     
    344344function bbp_topic_metabox() {
    345345
    346346        // Post ID
    347         $post_id = get_the_ID(); ?>
     347        $post_id          = get_the_ID();
     348        $parent_id        = bbp_get_topic_forum_id( $post_id );
     349        $parent_view_link = get_permalink( $parent_id );
     350        $parent_edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit', $parent_id ) );
    348351
     352        ?>
     353
    349354        <p>
    350355                <strong class="label"><?php _e( 'Type:', 'bbpress' ); ?></strong>
    351356                <label class="screen-reader-text" for="bbp_stick_topic"><?php _e( 'Topic Type', 'bbpress' ); ?></label>
     
    357362                <label class="screen-reader-text" for="parent_id"><?php _e( 'Forum', 'bbpress' ); ?></label>
    358363                <?php bbp_dropdown( array(
    359364                        'post_type'          => bbp_get_forum_post_type(),
    360                         'selected'           => bbp_get_topic_forum_id( $post_id ),
     365                        'selected'           => $parent_id,
    361366                        'numberposts'        => -1,
    362367                        'orderby'            => 'title',
    363368                        'order'              => 'ASC',
     
    373378                        'disable_categories' => current_user_can( 'edit_forums' ),
    374379                        'disabled'           => ''
    375380                ) ); ?>
     381                <?php if ( ! empty( $parent_view_link ) ): ?>
     382                        <br/>
     383                        <a href="<?php echo esc_attr( $parent_view_link );?>"><?php _e( 'View', 'bbpress' );?></a>
     384                        -
     385                        <a href="<?php echo esc_attr( $parent_edit_link );?>"><?php _e( 'Edit', 'bbpress' );?></a>
     386
     387                <?php endif; ?>
    376388        </p>
    377389
     390
    378391        <?php
    379392        wp_nonce_field( 'bbp_topic_metabox_save', 'bbp_topic_metabox' );
    380393        do_action( 'bbp_topic_metabox', $post_id );
     
    429442
    430443        <?php endif; ?>
    431444
     445        <?php
     446        $parent_view_link = get_permalink( $reply_topic_id );
     447        $parent_edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit', $reply_topic_id ) );
     448        ?>
    432449        <p>
    433450                <strong class="label"><?php _e( 'Topic:', 'bbpress' ); ?></strong>
    434451                <label class="screen-reader-text" for="parent_id"><?php _e( 'Topic', 'bbpress' ); ?></label>
    435452                <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr( $reply_topic_id ); ?>" />
     453
     454                <?php if ( ! empty( $parent_view_link ) ): ?>
     455                        <br/>
     456                        <a href="<?php echo esc_attr( $parent_view_link );?>"><?php _e( 'View', 'bbpress' );?></a>
     457                        -
     458                        <a href="<?php echo esc_attr( $parent_edit_link );?>"><?php _e( 'Edit', 'bbpress' );?></a>
     459
     460                <?php endif; ?>
     461
    436462        </p>
    437463
    438464        <?php