|
@@ 18-23 (lines=6) @@
|
| 15 |
|
// even though it's messy, we implement these hooks because |
| 16 |
|
// the edit_comment hook doesn't include the data |
| 17 |
|
// so this saves us a DB read for every comment event |
| 18 |
|
foreach ( array( '', 'trackback', 'pingback' ) as $comment_type ) { |
| 19 |
|
foreach ( array( 'unapproved', 'approved' ) as $comment_status ) { |
| 20 |
|
$comment_action_name = "comment_{$comment_status}_{$comment_type}"; |
| 21 |
|
add_action( $comment_action_name, $callable, 10, 2 ); |
| 22 |
|
} |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
// full sync |
| 26 |
|
add_action( 'jetpack_full_sync_comments', $callable ); // also send comments meta |
|
@@ 32-37 (lines=6) @@
|
| 29 |
|
public function init_before_send() { |
| 30 |
|
add_filter( 'jetpack_sync_before_send_wp_insert_comment', array( $this, 'expand_wp_insert_comment' ) ); |
| 31 |
|
|
| 32 |
|
foreach ( array( '', 'trackback', 'pingback' ) as $comment_type ) { |
| 33 |
|
foreach ( array( 'unapproved', 'approved' ) as $comment_status ) { |
| 34 |
|
$comment_action_name = "comment_{$comment_status}_{$comment_type}"; |
| 35 |
|
add_filter( 'jetpack_sync_before_send_' . $comment_action_name, array( $this, 'expand_wp_insert_comment' ) ); |
| 36 |
|
} |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
function expand_wp_comment_status_change( $args ) { |