Skip to:
Content

bbPress.org

Changeset 6790


Ignore:
Timestamp:
03/27/2018 07:38:26 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Admin: improve topic/reply row-action UX.

This change includes a few improvements to how topics and replies are toggled from an admin area list-table:

  • Make approve & not-spam links green to match comments UI
  • More specifically target admin area links to avoid conflicts with other post types
  • Make "Approve" a blanket "publish" action, meaning it will always publish a topic/reply even from spam or trash
  • Make sure "Not Spam" will restore to "pending" if it was previously not published
  • Bump CSS version

See #1799.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bbpress.php

    r6777 r6790  
    204204        /** Versions **********************************************************/
    205205
    206         $this->version    = '2.6-rc-6769';
     206        $this->version    = '2.6-rc-6789';
    207207        $this->db_version = '262';
    208208
  • trunk/src/includes/admin/assets/css/admin.css

    r6770 r6790  
    414414}
    415415
    416 #the-list .status-closed {
     416body.post-type-forum #the-list .status-closed,
     417body.post-type-topic #the-list .status-closed,
     418body.post-type-reply #the-list .status-closed {
    417419    background-color: #f5f5f5;
    418420}
    419421
    420 #the-list .status-closed:nth-child(odd) {
     422body.post-type-forum #the-list .status-closed:nth-child(odd),
     423body.post-type-topic #the-list .status-closed:nth-child(odd),
     424body.post-type-reply #the-list .status-closed:nth-child(odd) {
    421425    background-color: #f0f0f0;
    422426}
    423427
    424 #the-list .status-spam,
     428body.post-type-forum #the-list .status-spam,
     429body.post-type-topic #the-list .status-spam,
     430body.post-type-reply #the-list .status-spam,
    425431#bbp-reply-list .status-trash {
    426432    background-color: #fee;
    427433}
    428434
    429 #the-list .status-spam:nth-child(odd),
     435body.post-type-forum #the-list .status-spam:nth-child(odd),
     436body.post-type-topic #the-list .status-spam:nth-child(odd),
     437body.post-type-reply #the-list .status-spam:nth-child(odd),
    430438#bbp-reply-list .status-trash:nth-child(odd) {
    431439    background-color: #fdd;
    432440}
    433441
    434 #the-list .status-pending {
     442body.post-type-forum #the-list .status-pending,
     443body.post-type-topic #the-list .status-pending,
     444body.post-type-reply #the-list .status-pending {
    435445    background-color: #fff2e8;
    436446}
    437447
    438 #the-list .status-pending:nth-child(odd) {
     448body.post-type-forum #the-list .status-pending:nth-child(odd),
     449body.post-type-topic #the-list .status-pending:nth-child(odd),
     450body.post-type-reply #the-list .status-pending:nth-child(odd) {
    439451    background-color: #fff7f1;
    440452}
    441453
    442 #the-list .status-closed td,
    443 #the-list .status-spam td,
     454body.post-type-forum #the-list .status-closed td,
     455body.post-type-topic #the-list .status-closed td,
     456body.post-type-reply #the-list .status-closed td,
     457body.post-type-forum #the-list .status-spam td,
     458body.post-type-topic #the-list .status-spam td,
     459body.post-type-reply #the-list .status-spam td,
    444460#bbp-reply-list .status-trash td {
    445461    color: #999;
     462}
     463
     464body.post-type-forum #the-list .row-actions .unspam a,
     465body.post-type-topic #the-list .row-actions .unspam a,
     466body.post-type-reply #the-list .row-actions .unspam a,
     467body.post-type-forum #the-list .row-actions .approved a,
     468body.post-type-topic #the-list .row-actions .approved a,
     469body.post-type-reply #the-list .row-actions .approved a {
     470    color: #006505;
    446471}
    447472
  • trunk/src/includes/admin/replies.php

    r6780 r6790  
    471471                check_admin_referer( 'approve-reply_' . $reply_id );
    472472
    473                 $is_approve = bbp_is_reply_pending( $reply_id );
     473                $is_approve = bbp_is_reply_published( $reply_id );
    474474                $message    = ( true === $is_approve )
    475                     ? 'approved'
    476                     : 'unapproved';
     475                    ? 'unpproved'
     476                    : 'approved';
    477477                $success    = ( true === $is_approve )
    478478                    ? bbp_approve_reply( $reply_id )
     
    605605            'unapproved',
    606606            'spam',
     607            'unspam',
    607608            'trash',
    608609            'untrash',
     
    812813                $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 );
    813814                if ( bbp_is_reply_spam( $reply->ID ) ) {
    814                     $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . esc_html__( 'Not spam', 'bbpress' ) . '</a>';
     815                    $actions['unspam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . esc_html__( 'Not Spam', 'bbpress' ) . '</a>';
    815816                } else {
    816817                    $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark this reply as spam',    'bbpress' ) . '">' . esc_html__( 'Spam',     'bbpress' ) . '</a>';
  • trunk/src/includes/admin/topics.php

    r6780 r6790  
    589589                check_admin_referer( 'approve-topic_' . $topic_id );
    590590
    591                 $is_approve = bbp_is_topic_pending( $topic_id );
    592                 $message    = ( true === $is_approve )
    593                     ? 'approved'
    594                     : 'unapproved';
    595                 $success    = ( true === $is_approve )
     591                $is_approve = bbp_is_topic_published( $topic_id );
     592                $message    = ( false === $is_approve )
     593                    ? 'unapproved'
     594                    : 'approved';
     595                $success    = ( false === $is_approve )
    596596                    ? bbp_approve_topic( $topic_id )
    597597                    : bbp_unapprove_topic( $topic_id );
     
    788788            'closed',
    789789            'spam',
     790            'unspam',
    790791            'trash',
    791792            'untrash',
     
    10111012            $spam_uri = wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'spam-topic_'  . $topic->ID );
    10121013            if ( bbp_is_topic_spam( $topic->ID ) ) {
    1013                 $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the topic as not spam', 'bbpress' ) . '">' . esc_html__( 'Not spam', 'bbpress' ) . '</a>';
     1014                $actions['unspam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the topic as not spam', 'bbpress' ) . '">' . esc_html__( 'Not Spam', 'bbpress' ) . '</a>';
    10141015            } else {
    10151016                $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark this topic as spam',    'bbpress' ) . '">' . esc_html__( 'Spam',     'bbpress' ) . '</a>';
  • trunk/src/includes/topics/functions.php

    r6784 r6790  
    28532853    }
    28542854
     2855    // Get new status
     2856    $status = bbp_get_spam_status_id();
     2857
    28552858    // Bail if topic is spam
    2856     if ( bbp_get_spam_status_id() === $topic->post_status ) {
     2859    if ( $status === $topic->post_status ) {
    28572860        return false;
    28582861    }
     
    28652868
    28662869    // Set post status to spam
    2867     $topic->post_status = bbp_get_spam_status_id();
     2870    $topic->post_status = $status;
    28682871
    28692872    // Empty the topic of its tags
     
    31563159    }
    31573160
     3161    // Get new status
     3162    $status = bbp_get_public_status_id();
     3163
    31583164    // Bail if already approved
    3159     if ( bbp_get_pending_status_id() !== $topic->post_status ) {
     3165    if ( $status === $topic->post_status ) {
    31603166        return false;
    31613167    }
     
    31963202    }
    31973203
     3204    // Get new status
     3205    $status = bbp_get_pending_status_id();
     3206
    31983207    // Bail if already pending
    3199     if ( bbp_get_pending_status_id() === $topic->post_status ) {
     3208    if ( $status === $topic->post_status ) {
    32003209        return false;
    32013210    }
     
    32053214
    32063215    // Set pending status
    3207     $topic->post_status = bbp_get_pending_status_id();
     3216    $topic->post_status = $status;
    32083217
    32093218    // No revisions
Note: See TracChangeset for help on using the changeset viewer.