Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #11515, comment 18


Ignore:
Timestamp:
03/15/2013 11:40:46 PM (11 years ago)
Author:
obenland
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11515, comment 18

    initial v1  
    1818#!php
    1919
    20 // How it's currently done:
     20/**
     21 * How it's currently done
     22 */
    2123// See: http://core.trac.wordpress.org/browser/trunk/wp-admin/comment.php#L96
    2224if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     
    2527}
    2628
    27 //How it could be done:
     29// Error handling in edit-comment.php
     30if ( isset( $_REQUEST['error'] ) ) {
     31        $error = (int) $_REQUEST['error'];
     32        $error_msg = '';
     33        switch ( $error ) {
     34                case 1 :
     35                        $error_msg = __( 'Oops, no comment with this ID.' );
     36                        break;
     37                case 2 :
     38                        $error_msg = __( 'You are not allowed to edit comments on this post.' );
     39                        break;
     40        }
     41        if ( $error_msg )
     42                add_admin_notice( 'moderated', $error_msg );
     43}
     44
     45
     46/**
     47 * How it could be done:
     48 */
    2849// No error handling in edit-comments.php necessary.
    2950if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {