Support » Plugin: Disqus Comment System » A bug when exec comments sync

  • disqus-comment-system/rest-api/class-disqus-rest-api.php
    > comment_data_from_post

    In this method(comment_data_from_post), there are some code lines.

    
    $identifiers = $thread['identifiers'];
    $first_identifier = count( $identifiers ) > 0 ? $identifiers[0] : null;
    
    if ( null !== $first_identifier ) {
        $ident_parts = explode( ' ', $first_identifier, 2 );
        $wp_post_id = reset( $ident_parts );
    }
    // Keep the post's thread ID meta up to date.
    update_post_meta( $wp_post_id, 'dsq_thread_id', $thread['id'] );
    

    This line $first_identifier = count( $identifiers ) > 0 ? $identifiers[0] : null;,
    it will cause the $first_identifier gets the wrong data. Because $identifiers may is

    Array
    (
        [0] => https://xxxx.com/knowledge/solved-discord-screen-share-audio-not-working/
        [1] => 87956 https://xxxx.com/?post_type=knowledgebase&p=87956
    )

    .

    $identifiers[0] cannot get any valid post_id!
    Finally, $wp_post_id is a url string, not integer id, the comment will lose the relation with its post.

    Please optimize it. Thank you!

    • This topic was modified 1 year, 4 months ago by quasarzero.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A bug when exec comments sync’ is closed to new replies.