Advertisement
simonwheatley

WPML Comment Merging change

Sep 14th, 2011
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.88 KB | None | 0 0
  1. Index: wpml-comment-merging/wpml-comment-merging.php
  2. ===================================================================
  3. --- wpml-comment-merging/wpml-comment-merging.php   (revision 438094)
  4. +++ wpml-comment-merging/wpml-comment-merging.php   (working copy)
  5. @@ -14,10 +14,13 @@
  6.  }
  7.  
  8.  function merge_comments($comments, $post_ID) {
  9. +   global $sitepress;
  10. +   remove_filter( 'comments_clauses', array( $sitepress, 'comments_clauses' ) );
  11.     // get all the languages for which this post exists
  12.     $languages = icl_get_languages('skip_missing=1');
  13. -   $type = is_page($post_ID) ? 'page' : 'post';
  14. -   foreach($languages as $l) {
  15. +   $post = get_post( $post_ID );
  16. +   $type = $post->post_type;
  17. +   foreach($languages as $code => $l) {
  18.         // in $comments are already the comments from the current language
  19.         if(!$l['active']) {
  20.             $otherID = icl_object_id($post_ID, $type, false, $l['language_code']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement