Skip to:
Content

bbPress.org

Changeset 6312


Ignore:
Timestamp:
02/26/2017 06:04:52 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Moderation: Maybe add view=all query-arguments to view links in row actions.

Fixes #2938.

Location:
trunk/src/includes/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/replies.php

    r6272 r6312  
    764764        unset( $actions['inline hide-if-no-js'] );
    765765
     766        // View link
     767        $view_link = bbp_get_reply_url( $reply->ID );
     768
     769        // Maybe add view=all
     770        if ( ! in_array( $reply->post_status, array( bbp_get_closed_status_id(), bbp_get_public_status_id() ), true ) ) {
     771            $view_link = bbp_add_view_all( $view_link, true );
     772        }
     773
    766774        // Reply view links to topic
    767         $actions['view'] = '<a href="' . esc_url( bbp_get_reply_url( $reply->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_reply_title( $reply->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
     775        $actions['view'] = '<a href="' . esc_url( $view_link ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_reply_title( $reply->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
    768776
    769777        // User cannot view replies in trash
    770         if ( ( bbp_get_trash_status_id() === $reply->post_status ) && !current_user_can( 'view_trash' ) ) {
     778        if ( ( bbp_get_trash_status_id() === $reply->post_status ) && ! current_user_can( 'view_trash' ) ) {
    771779            unset( $actions['view'] );
    772780        }
     
    784792
    785793            // Show the 'spam' link on published and pending replies and 'not spam' on spammed replies
    786             if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_pending_status_id(), bbp_get_spam_status_id() ) ) ) {
     794            if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_pending_status_id(), bbp_get_spam_status_id() ), true ) ) {
    787795                $spam_uri  = wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_'  . $reply->ID );
    788796                if ( bbp_is_reply_spam( $reply->ID ) ) {
     
    803811            }
    804812
    805             if ( bbp_get_trash_status_id() === $reply->post_status || !EMPTY_TRASH_DAYS ) {
     813            if ( bbp_get_trash_status_id() === $reply->post_status || ! EMPTY_TRASH_DAYS ) {
    806814                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $reply->ID, '', true ) ) . "'>" . esc_html__( 'Delete Permanently', 'bbpress' ) . "</a>";
    807815            } elseif ( bbp_get_spam_status_id() === $reply->post_status ) {
  • trunk/src/includes/admin/topics.php

    r6272 r6312  
    918918        unset( $actions['inline hide-if-no-js'] );
    919919
     920        // View link
     921        $view_link = bbp_get_topic_permalink( $topic->ID );
     922
     923        // Maybe add view=all
     924        if ( ! in_array( $topic->post_status, array( bbp_get_closed_status_id(), bbp_get_public_status_id() ), true ) ) {
     925            $view_link = bbp_add_view_all( $view_link, true );
     926        }
     927
    920928        // Show view link if it's not set, the topic is trashed and the user can view trashed topics
    921929        if ( empty( $actions['view'] ) && ( bbp_get_trash_status_id() === $topic->post_status ) && current_user_can( 'view_trash' ) ) {
    922             $actions['view'] = '<a href="' . esc_url( bbp_get_topic_permalink( $topic->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
     930            $actions['view'] = '<a href="' . esc_url( $view_link ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
    923931        }
    924932
     
    933941            } elseif ( ! bbp_is_topic_private( $topic->ID ) ) {
    934942                $actions['approved']   = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Approve this topic',   'bbpress' ) . '">' . _x( 'Approve',   'Approve Topic',   'bbpress' ) . '</a>';
    935                 $actions['view']       = '<a href="' . esc_url( bbp_get_topic_permalink( $topic->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
     943                $actions['view']       = '<a href="' . esc_url( $view_link  ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'bbpress' ) . '</a>';
    936944            }
    937945
Note: See TracChangeset for help on using the changeset viewer.