Make WordPress Core

Ticket #15898: garyc40-15898-rev2.patch

File garyc40-15898-rev2.patch, 4.8 KB (added by garyc40, 15 years ago)

actually approve the comment on the backend

  • wp-admin/admin-ajax.php

    diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php
    index b6420e2..ab58456 100644
    case 'replyto-comment' : 
    661661        $comment_id = wp_new_comment( $commentdata );
    662662        $comment = get_comment($comment_id);
    663663        if ( ! $comment ) die('1');
    664 
     664        if ( ! wp_update_comment( array( 'comment_ID' => $comment_parent, 'comment_approved' => 'approve' ) ) ) {
     665                die('1');
     666        }
    665667        $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
    666668
    667669        $x = new WP_Ajax_Response();
  • wp-admin/css/wp-admin.dev.css

    diff --git wp-admin/css/wp-admin.dev.css wp-admin/css/wp-admin.dev.css
    index 13694dd..4c5fe6b 100644
    table.fixed { 
    13731373        width: 20%;
    13741374}
    13751375
     1376.comments tr.focus th, .comments tr.focus td {
     1377        border-top-width:1px;
     1378        border-top-style:solid;
     1379}
     1380
     1381.comments tr.blur th, .comments tr.blur td {
     1382        border-bottom-width:0;
     1383}
     1384
    13761385.sorting-indicator {
    13771386        display: none;
    13781387        width: 21px;
  • wp-admin/js/edit-comments.dev.js

    diff --git wp-admin/js/edit-comments.dev.js wp-admin/js/edit-comments.dev.js
    index 796ead0..8c40d83 100644
    setCommentsList = function() { 
    249249commentReply = {
    250250        cid : '',
    251251        act : '',
     252       
     253        showOverlay : function(id) {
     254                var c = $('#comment-' + id),
     255                        excluded = c.find('td, th').css('opacity', 1).add('td, th', '#replyrow');
     256                listTable.$tbody.find('td, th').not(excluded).animate({opacity:'0.2'}, 300);
     257                c.addClass('focus');
     258                c.prev().addClass('blur');
     259        },
     260       
     261        hideOverlay : function() {
     262                listTable.$tbody.
     263                        find('.blur').removeClass('blur').end().
     264                        find('.focus').removeClass('focus');
     265        },
    252266
    253267        init : function() {
    254268                var row = $('#replyrow');
    commentReply = { 
    294308
    295309                if ( $('#the-comment-list #replyrow').length < 1 )
    296310                        return false;
     311                       
     312                listTable.$tbody.find('th, td').animate({opacity : 1}, 300);
    297313
    298314                $('#replyrow').fadeOut('fast', function(){
    299315                        commentReply.close();
    commentReply = { 
    317333                        $('input', '#edithead').val('');
    318334                        $('.error', '#replysubmit').html('').hide();
    319335                        $('.waiting', '#replysubmit').hide();
     336                        this.hideOverlay();
    320337
    321338                        if ( $.browser.msie )
    322339                                $('#replycontainer, #replycontent').css('height', '120px');
    commentReply = { 
    328345        },
    329346
    330347        open : function(id, p, a) {
    331                 var t = this, editRow, rowData, act, h, c = $('#comment-' + id);
     348                var t = this, editRow, rowData, act, h, c = $('#comment-' + id), replyButton;
    332349                t.close();
    333350                t.cid = id;
    334351
    commentReply = { 
    340357                $('#action', editRow).val(act);
    341358                $('#comment_post_ID', editRow).val(p);
    342359                $('#comment_ID', editRow).val(id);
    343 
     360                t.showOverlay(id);
     361               
    344362                if ( a == 'edit' ) {
    345363                        $('#author', editRow).val( $('div.author', rowData).text() );
    346364                        $('#author-email', editRow).val( $('div.author-email', rowData).text() );
    commentReply = { 
    361379                                $('#replyrow').fadeIn(300, function(){ $(this).show() });
    362380                        });
    363381                } else {
     382                        replyButton = $('#replybtn', editRow);
    364383                        $('#edithead, #savebtn', editRow).hide();
    365384                        $('#replyhead, #replybtn', editRow).show();
    366385                        c.after(editRow);
     386                        if (c.hasClass('unapproved')) {
     387                                replyButton.text(adminCommentsL10n.replyApprove);
     388                        } else {
     389                                replyButton.text(adminCommentsL10n.reply);
     390                        }
    367391                        $('#replyrow').fadeIn(300, function(){ $(this).show() });
    368392                }
    369393
    commentReply = { 
    401425        },
    402426
    403427        send : function() {
    404                 var post = {};
     428                var post = {}, c;
    405429
    406430                $('#replysubmit .waiting').show();
    407431
    commentReply = { 
    413437                post.id = post.comment_post_ID;
    414438                post.comments_listing = this.comments_listing;
    415439                post.p = $('[name=p]').val();
    416 
     440                c = $('#comment-' + post.comment_ID);
    417441                $.ajax({
    418442                        type : 'POST',
    419443                        url : ajaxurl,
    420444                        data : post,
    421                         success : function(x) { commentReply.show(x); },
     445                        success : function(x) {
     446                                if (c.hasClass('unapproved')) {
     447                                        c.removeClass('unapproved').addClass('approved');
     448                                }
     449                                commentReply.show(x);
     450                        },
    422451                        error : function(r) { commentReply.error(r); }
    423452                });
    424453
  • wp-includes/script-loader.php

    diff --git wp-includes/script-loader.php wp-includes/script-loader.php
    index ef54e08..79904b6 100644
    function wp_default_scripts( &$scripts ) { 
    317317                $scripts->add_data( 'admin-comments', 'group', 1 );
    318318                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
    319319                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
    320                         'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
     320                        'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
     321                        'replyApprove' => __( 'Approve and Reply' ),
     322                        'reply' => __( 'Reply' ),
    321323                ) );
    322324
    323325                $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20100403' );