Skip to:
Content

bbPress.org

Changeset 2586


Ignore:
Timestamp:
11/01/2010 06:07:32 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Fixes #1321. Also add checks to topic_id and forum_id functions.

Location:
branches/plugin
Files:
2 edited

Legend:

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

    r2579 r2586  
    361361            return $column;
    362362
     363        // Get topic forum ID
     364        $forum_id = bbp_get_topic_forum_id();
     365
     366        // Populate column data
    363367        switch ( $column ) {
     368            // Forum
    364369            case 'bbp_topic_forum' :
    365370                // Output forum name
     
    368373                // Link information
    369374                $actions = apply_filters( 'topic_forum_row_actions', array (
    370                     'edit' => '<a href="' . add_query_arg( array( 'post' => bbp_get_topic_forum_ID(), 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
    371                     'view' => '<a href="' . bbp_get_topic_permalink() . '">' . __( 'View', 'bbpress' ) . '</a>'
     375                    'edit' => '<a href="' . add_query_arg( array( 'post' => $forum_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
     376                    'view' => '<a href="' . bbp_get_forum_permalink( $forum_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
    372377                ) );
    373378
     
    383388                break;
    384389
     390            // Reply Count
    385391            case 'bbp_topic_reply_count' :
    386392                // Output replies count
     
    388394                break;
    389395
     396            // Freshness
    390397            case 'bbp_topic_freshness' :
    391398                // Output last activity time and date
     
    393400                break;
    394401
     402            // Do an action for anything else
    395403            default :
    396404                do_action( 'bbp_admin_topics_column_data', $column, $post_id );
     
    449457            return $column;
    450458
     459        // Get topic ID
     460        $topic_id = bbp_get_topic_forum_id();
     461
     462        // Populate Column Data
    451463        switch ( $column ) {
     464            // Topic
    452465            case 'bbp_reply_topic' :
    453466                // Output forum name
     
    456469                // Link information
    457470                $actions = apply_filters( 'topic_forum_row_actions', array (
    458                     'edit' => '<a href="' . add_query_arg( array( 'post' => bbp_get_topic_forum_ID(), 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
    459                     'view' => '<a href="' . bbp_get_topic_permalink() . '">' . __( 'View', 'bbpress' ) . '</a>'
     471                    'edit' => '<a href="' . add_query_arg( array( 'post' => $topic_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
     472                    'view' => '<a href="' . bbp_get_topic_permalink( $topic_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
    460473                ) );
    461474
     
    471484                break;
    472485
     486            // Forum
    473487            case 'bbp_reply_forum' :
    474488                // Output replies count
    475489                break;
    476490
     491            // Freshness
    477492            case 'bbp_topic_freshness':
    478493                // Output last activity time and date
     
    480495                break;
    481496
     497            // Do action for anything else
    482498            default :
    483499                do_action( 'bbp_admin_replies_column_data', $column, $post_id );
  • branches/plugin/bbp-templatetags.php

    r2583 r2586  
    141141            $bbp_forum_id = $wp_query->post->ID;
    142142
     143        // Currently viewing a topic
     144        elseif ( bbp_is_topic() )
     145            $bbp_forum_id = bbp_get_topic_forum_id();
     146
    143147        // Fallback
    144148        // @todo - experiment
     
    179183     */
    180184    function bbp_get_forum_permalink ( $forum_id = 0 ) {
     185        if ( empty( $forum_id ) )
     186            $forum_id = bbp_get_forum_id();
     187
    181188        return apply_filters( 'bbp_get_forum_permalink', get_permalink( $forum_id ) );
    182189    }
     
    533540        elseif ( bbp_is_topic() && isset( $wp_query->post->ID ) )
    534541            $bbp_topic_id = $wp_query->post->ID;
     542
     543        // Currently viewing a singular reply
     544        elseif ( bbp_is_reply() )
     545            $bbp_topic_id = bbp_get_reply_topic_id();
    535546
    536547        // Fallback
Note: See TracChangeset for help on using the changeset viewer.