• Resolved Nova Year

    (@novayear)


    Hello my friend. The feature of sending update notification when a comment is added is malfunctioning. For example, all comments must be manually approved option on wordpress is turned on. In this case, it waits for approval when the comment is added, but sends an update notification before the comment is approved. send an update notification after the comment is approved.

    It sends a notification when you add a comment, but it has to wait for the comment to be approved first.

    Thank you for your attention.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mihdan

    (@mihdan)

    Hi Nova Year,

    Implemented in the next update

    Thread Starter Nova Year

    (@novayear)

    Hello again,
    Overall the plugin works very well. Is the content update notification only in the index-now service? Content updated feedback is not given in yandex and google webmaster services? For example, when a comment is written on an article, the index-now service is notified that the page about this article has been updated, but this update notification is not made in other services. In all services, when a new article / content is added, the notification is made, but the update notification is only in the index-now service, could it be an error in the codes? It caught my attention, I just wanted to ask. thanks good work.

    • This reply was modified 1 year, 7 months ago by Nova Year. Reason: in content wrong html tag fixing
    Plugin Support mihdan

    (@mihdan)

    Hi

    This functionality will be implemented in the next update

    Thread Starter Nova Year

    (@novayear)

    Hello friend, I waited for an update, but when it did not arrive, I edited the codes manually.

    IndexNow v2.6.0: Manual changes…

    wp-content\plugins\mihdan-index-now\src\Hooks.php
    Replace line 35 with the code below or add // at the beginning:
    //add_action( ‘wp_insert_comment’, [ $this, ‘comment_updated’ ], 10, 2 );

    Add a new line between lines 35 and 36 and write this code:
    add_action( ‘transition_comment_status’, [ $this, ‘comment_status_updated’ ], 10, 3 );

    Lines 34,35, 36 and 37 should look like this:
    add_action( ‘transition_post_status’, [ $this, ‘post_updated’ ], 10, 3 );
    //add_action( ‘wp_insert_comment’, [ $this, ‘comment_updated’ ], 10, 2 );
    add_action( ‘transition_comment_status’, [ $this, ‘comment_status_updated’ ], 10, 3 );
    add_action( ‘saved_term’, [ $this, ‘term_updated’ ], 10, 3 );

    Add the last code before the line below.
    Line 106 : public function comment_updated( int $id, WP_Comment $comment ): void {
    Add this codes::
    public function comment_status_updated(string $new_status,string $old_status,WP_Comment $comment): void{
    if($new_status!==’approved’){return;}
    // Run only comment approved.
    if($old_status===’unapproved’ and $new_status===’approved’){
    // Delay.
    $last_update = (int) get_comment_meta($id,Utils::get_plugin_prefix().’_last_update’,true);
    if((current_time(‘timestamp’)-$last_update)<$this->ping_delay){return;}
    do_action(‘mihdan_index_now/comment_updated’,$comment->comment_post_ID,$comment);
    update_comment_meta($id,Utils::get_plugin_prefix().’_last_update’,current_time(‘timestamp’));
    }
    }

    If you can’t do it, you can get the codes of the entire page ready-made here:
    https://gist.github.com/NovaYear/52645febca60010f3ab124b4287e58a9

    Plugin Support mihdan

    (@mihdan)

    Hi

    Wow, that’s really cool. Will do an update today, thanks

    Plugin Support mihdan

    (@mihdan)

    Fixed in 2.6.1

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘update feature is wrong when comment is added’ is closed to new replies.