Plugin Directory

Changeset 2471362


Ignore:
Timestamp:
02/09/2021 07:27:48 AM (5 years ago)
Author:
imahui
Message:

version 1.3.7

Location:
wp-mini-program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-mini-program/tags/1.3.7/router/comments.php

    r2471336 r2471362  
    251251        } else {
    252252            $message = wp_miniprogram_comment_type( $type );
    253             $eliminate = apply_filters( 'custom_comment_type_eliminate', $type );;
     253            $eliminate = apply_filters( 'custom_comment_type_eliminate', $type );
    254254            if( $eliminate ) {
     255                if( $parent_id != 0 ) {
     256                    return new WP_Error( 'error', '父类 ID 错误, ID 必须为 0', array( 'status' => 403 ) );
     257                }
    255258                $args = array('post_id' => $post_id, 'type__in' => array( $type ), 'user_id' => $user_id, 'parent' => 0, 'status' => 'approve', 'orderby' => 'comment_date', 'order' => 'DESC');
    256259                $custom_comment = get_comments( $args );
     
    271274                } else {
    272275                    $customarr = array(
    273                         'comment_post_ID' => $post_id, // to which post the comment will show up
    274                         'comment_author' => ucfirst($user_name), //fixed value - can be dynamic
    275                         'comment_author_email' => $user_email, //fixed value - can be dynamic
    276                         'comment_author_url' => $user_url, //fixed value - can be dynamic
    277                         'comment_content' => $content, //fixed value - can be dynamic
     276                        'comment_post_ID' => $post_id,
     277                        'comment_author' => ucfirst($user_name),
     278                        'comment_author_email' => $user_email,
     279                        'comment_author_url' => $user_url,
     280                        'comment_content' => $content,
    278281                        'comment_author_IP' => '',
    279                         'comment_type' => $type, //empty for regular comments, 'pingback' for pingbacks, 'trackback' for trackbacks
    280                         'comment_parent' => $parent_id, //0 if it's not a reply to another comment; if it's a reply, mention the parent comment ID here
    281                         'comment_approved' => 1, // Whether the comment has been approved
    282                         'user_id' => $user_id, //passing current user ID or any predefined as per the demand
     282                        'comment_type' => $type,
     283                        'comment_parent' => $parent_id,
     284                        'comment_approved' => 1,
     285                        'user_id' => $user_id
    283286                    );
    284287                    $comment_id = wp_insert_comment( $customarr );
     
    294297                }
    295298            } else {
     299                $args = array('post_id' => $post_id, 'type__in' => array( $type ), 'user_id' => $user_id, 'parent' => $parent_id, 'status' => 'approve', 'orderby' => 'comment_date', 'order' => 'DESC');
     300                $custom_comment = get_comments( $args );
     301                if( $custom_comment ) {
     302                    foreach ( $custom_comment as $comment ) {
     303                        $parent_id = (int)$comment->comment_ID;
     304                    }
     305                }
    296306                $customarr = array(
    297                     'comment_post_ID' => $post_id, // to which post the comment will show up
    298                     'comment_author' => ucfirst($user_name), //fixed value - can be dynamic
    299                     'comment_author_email' => $user_email, //fixed value - can be dynamic
    300                     'comment_author_url' => $user_url, //fixed value - can be dynamic
    301                     'comment_content' => $content, //fixed value - can be dynamic
     307                    'comment_post_ID' => $post_id,
     308                    'comment_author' => ucfirst($user_name),
     309                    'comment_author_email' => $user_email,
     310                    'comment_author_url' => $user_url,
     311                    'comment_content' => $content,
    302312                    'comment_author_IP' => '',
    303                     'comment_type' => $type, //empty for regular comments, 'pingback' for pingbacks, 'trackback' for trackbacks
    304                     'comment_parent' => $parent_id, //0 if it's not a reply to another comment; if it's a reply, mention the parent comment ID here
    305                     'comment_approved' => 1, // Whether the comment has been approved
    306                     'user_id' => $user_id, //passing current user ID or any predefined as per the demand
     313                    'comment_type' => $type,
     314                    'comment_parent' => $parent_id,
     315                    'comment_approved' => 1,
     316                    'user_id' => $user_id
    307317                );
    308318                $comment_id = wp_insert_comment( $customarr );
  • wp-mini-program/trunk/router/comments.php

    r2471336 r2471362  
    251251        } else {
    252252            $message = wp_miniprogram_comment_type( $type );
    253             $eliminate = apply_filters( 'custom_comment_type_eliminate', $type );;
     253            $eliminate = apply_filters( 'custom_comment_type_eliminate', $type );
    254254            if( $eliminate ) {
     255                if( $parent_id != 0 ) {
     256                    return new WP_Error( 'error', '父类 ID 错误, ID 必须为 0', array( 'status' => 403 ) );
     257                }
    255258                $args = array('post_id' => $post_id, 'type__in' => array( $type ), 'user_id' => $user_id, 'parent' => 0, 'status' => 'approve', 'orderby' => 'comment_date', 'order' => 'DESC');
    256259                $custom_comment = get_comments( $args );
     
    271274                } else {
    272275                    $customarr = array(
    273                         'comment_post_ID' => $post_id, // to which post the comment will show up
    274                         'comment_author' => ucfirst($user_name), //fixed value - can be dynamic
    275                         'comment_author_email' => $user_email, //fixed value - can be dynamic
    276                         'comment_author_url' => $user_url, //fixed value - can be dynamic
    277                         'comment_content' => $content, //fixed value - can be dynamic
     276                        'comment_post_ID' => $post_id,
     277                        'comment_author' => ucfirst($user_name),
     278                        'comment_author_email' => $user_email,
     279                        'comment_author_url' => $user_url,
     280                        'comment_content' => $content,
    278281                        'comment_author_IP' => '',
    279                         'comment_type' => $type, //empty for regular comments, 'pingback' for pingbacks, 'trackback' for trackbacks
    280                         'comment_parent' => $parent_id, //0 if it's not a reply to another comment; if it's a reply, mention the parent comment ID here
    281                         'comment_approved' => 1, // Whether the comment has been approved
    282                         'user_id' => $user_id, //passing current user ID or any predefined as per the demand
     282                        'comment_type' => $type,
     283                        'comment_parent' => $parent_id,
     284                        'comment_approved' => 1,
     285                        'user_id' => $user_id
    283286                    );
    284287                    $comment_id = wp_insert_comment( $customarr );
     
    294297                }
    295298            } else {
     299                $args = array('post_id' => $post_id, 'type__in' => array( $type ), 'user_id' => $user_id, 'parent' => $parent_id, 'status' => 'approve', 'orderby' => 'comment_date', 'order' => 'DESC');
     300                $custom_comment = get_comments( $args );
     301                if( $custom_comment ) {
     302                    foreach ( $custom_comment as $comment ) {
     303                        $parent_id = (int)$comment->comment_ID;
     304                    }
     305                }
    296306                $customarr = array(
    297                     'comment_post_ID' => $post_id, // to which post the comment will show up
    298                     'comment_author' => ucfirst($user_name), //fixed value - can be dynamic
    299                     'comment_author_email' => $user_email, //fixed value - can be dynamic
    300                     'comment_author_url' => $user_url, //fixed value - can be dynamic
    301                     'comment_content' => $content, //fixed value - can be dynamic
     307                    'comment_post_ID' => $post_id,
     308                    'comment_author' => ucfirst($user_name),
     309                    'comment_author_email' => $user_email,
     310                    'comment_author_url' => $user_url,
     311                    'comment_content' => $content,
    302312                    'comment_author_IP' => '',
    303                     'comment_type' => $type, //empty for regular comments, 'pingback' for pingbacks, 'trackback' for trackbacks
    304                     'comment_parent' => $parent_id, //0 if it's not a reply to another comment; if it's a reply, mention the parent comment ID here
    305                     'comment_approved' => 1, // Whether the comment has been approved
    306                     'user_id' => $user_id, //passing current user ID or any predefined as per the demand
     313                    'comment_type' => $type,
     314                    'comment_parent' => $parent_id,
     315                    'comment_approved' => 1,
     316                    'user_id' => $user_id
    307317                );
    308318                $comment_id = wp_insert_comment( $customarr );
Note: See TracChangeset for help on using the changeset viewer.