Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/10/2011 10:27:19 PM (13 years ago)
Author:
johnjamesjacoby
Message:

API adjustments:

  • Refactor _status_ vars into callable functions.
  • Audit usage of $bbp global.
  • Perform get_class() checks on extensions to avoid errors if global $bbp is overloaded.
  • Bump DB version to 175.
File:
1 edited

Legend:

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

    r3445 r3505  
    666666     */
    667667    function replies_row_actions( $actions, $reply ) {
    668         global $bbp;
    669668
    670669        if ( bbp_get_reply_post_type() == $reply->post_type ) {
     
    680679            // Only show the actions if the user is capable of viewing them
    681680            if ( current_user_can( 'moderate', $reply->ID ) ) {
    682                 if ( in_array( $reply->post_status, array( 'publish', $bbp->spam_status_id ) ) ) {
     681                if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) {
    683682                    $spam_uri  = esc_url( 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 ) );
    684                     if ( bbp_is_reply_spam( $reply->ID ) )
     683                    if ( bbp_is_reply_spam( $reply->ID ) ) {
    685684                        $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>';
    686                     else
     685                    } else {
    687686                        $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this reply as spam',    'bbpress' ) . '">' . __( 'Spam',     'bbpress' ) . '</a>';
     687                    }
    688688                }
    689689            }
     
    691691            // Trash
    692692            if ( current_user_can( 'delete_reply', $reply->ID ) ) {
    693                 if ( $bbp->trash_status_id == $reply->post_status ) {
     693                if ( bbp_get_trash_status_id() == $reply->post_status ) {
    694694                    $post_type_object = get_post_type_object( bbp_get_reply_post_type() );
    695695                    $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>";
     
    698698                }
    699699
    700                 if ( $bbp->trash_status_id == $reply->post_status || !EMPTY_TRASH_DAYS ) {
     700                if ( bbp_get_trash_status_id() == $reply->post_status || !EMPTY_TRASH_DAYS ) {
    701701                    $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>";
    702                 } elseif ( $bbp->spam_status_id == $reply->post_status ) {
     702                } elseif ( bbp_get_spam_status_id() == $reply->post_status ) {
    703703                    unset( $actions['trash'] );
    704704                }
     
    873873    global $bbp;
    874874
     875    // Bail if bbPress is not loaded
     876    if ( 'bbPress' !== get_class( $bbp ) ) return;
     877
    875878    $bbp->admin->replies = new BBP_Replies_Admin();
    876879}
Note: See TracChangeset for help on using the changeset viewer.