Skip to:
Content

bbPress.org

Changeset 4962


Ignore:
Timestamp:
05/28/2013 05:52:12 PM (13 years ago)
Author:
johnjamesjacoby
Message:

When adding the reply_to link, only add onclick if threaded replies are enabled. See #2340.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/replies/template-tags.php

    r4952 r4962  
    15341534                ), 'get_reply_to_link' );
    15351535
     1536                // Get the reply to use it's ID and post_parent
    15361537                $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) );
    15371538
    … …  
    15411542
    15421543                // Build the URI and return value
    1543                 $uri      = remove_query_arg( array( 'bbp_reply_to' ) );
    1544                 $uri      = add_query_arg( array( 'bbp_reply_to' => $reply->ID ) );
    1545                 $uri      = wp_nonce_url( $uri, 'respond_id_' . $reply->ID );
    1546                 $uri      = $uri . '#new-post';
    1547                 $onclick  = 'return addReply.moveForm("' . $r['add_below'] . '-' . $reply->ID . '","' . $reply->ID . '","' . $r['respond_id'] . '","' . $reply->post_parent . '")';
     1544                $uri = remove_query_arg( array( 'bbp_reply_to' ) );
     1545                $uri = add_query_arg( array( 'bbp_reply_to' => $reply->ID ) );
     1546                $uri = wp_nonce_url( $uri, 'respond_id_' . $reply->ID );
     1547                $uri = $uri . '#new-post';
     1548
     1549                // Only add onclick if replies are threaded
     1550                if ( bbp_thread_replies() ) {
     1551
     1552                        // Array of classes to pass to moveForm
     1553                        $move_form = array(
     1554                                $r['add_below'] . '-' . $reply->ID,
     1555                                $reply->ID,
     1556                                $r['respond_id'],
     1557                                $reply->post_parent
     1558                        );
     1559
     1560                        // Build the onclick
     1561                        $onclick  = ' onclick="return addReply.moveForm(\'' . implode( "','", $move_form ) . '\');"';
     1562
     1563                // No onclick if replies are not threaded
     1564                } else {
     1565                        $onclick  = '';
     1566                }
     1567
     1568                // Add $uri to the array, to be passed through the filter
    15481569                $r['uri'] = $uri;
    1549                 $retval   = $r['link_before'] . '<a href="' . esc_url( $r['uri'] ) . '" class="bbp-reply-to-link" onclick=' . "'{$onclick}' >" . esc_html( $r['reply_text'] ) . '</a>' . $r['link_after'];
     1570                $retval   = $r['link_before'] . '<a href="' . esc_url( $r['uri'] ) . '" class="bbp-reply-to-link"' . $onclick . '>' . esc_html( $r['reply_text'] ) . '</a>' . $r['link_after'];
    15501571
    15511572                return apply_filters( 'bbp_get_reply_to_link', $retval, $r, $args );
Note: See TracChangeset for help on using the changeset viewer.