Will this be ported to D7?

CommentFileSizeAuthor
#5 ignore_user.d7commentfix.patch2.86 KBNitroPye

Comments

nicholosophy’s picture

Assigned: Unassigned » nicholosophy
Issue tags: +undefined

I'm going to attempt this. No guarantees.

nicholosophy’s picture

Issue tags: -undefined +port to d7
jaydub’s picture

Assigned: nicholosophy » jaydub

Starting work on this now.

jaydub’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
NitroPye’s picture

Status: Active » Needs review
StatusFileSize
new2.86 KB

D7 port was not working at all for comments so I made a few updates to get it to work. See code below or attached patch.

diff --git ignore_user.js ignore_user.js
index 6e8d96c..4ad50db 100644
--- ignore_user.js
+++ ignore_user.js
@@ -1,5 +1,5 @@
 
-if (Drupal.jsEnabled) {
+(function ($) {
   $(document).ready(function () {
     $('div.ignore-user-container > div').hide();
     $('div.ignore-user-container > a.ignore-user-content-link').click(function() {
@@ -7,4 +7,4 @@ if (Drupal.jsEnabled) {
       return false;
     });
   });
-}
+})(jQuery);
diff --git ignore_user.module ignore_user.module
index 12093bb..ea1612b 100644
--- ignore_user.module
+++ ignore_user.module
@@ -14,7 +14,7 @@ function ignore_user_help($path, $arg) {
  * Implements hook_init().
  */
 function ignore_user_init() {
-  drupal_add_js(drupal_get_path('module', 'ignore_user') . '/ignore_user.js', 'module');
+  drupal_add_js(drupal_get_path('module', 'ignore_user') . '/ignore_user.js');
 }
 
 /**
@@ -259,7 +259,6 @@ function ignore_user_node_view_alter(&$build) {
   global $user;
   static $authors;
   $node = $build['#node'];
-
   if (!$user || !$user->uid || !$node->uid) {
     return;
   }
@@ -278,25 +277,23 @@ function ignore_user_node_view_alter(&$build) {
 /**
  * Implements hook_comment().
  */
-function ignore_user_comment($comment, $op) {
+function ignore_user_comment_view_alter(&$build) {
   global $user;
   static $authors;
-
+  $comment = $build['#comment'];
+  
   if (!$user || !$user->uid || !$comment->uid) {
     return;
   }
 
-  switch ($op) {
-    case 'view':
-      if (_ignore_user_ignored_user($comment->uid)) {
-        if (!$authors[$comment->uid]) {
-          $authors[$comment->uid] = user_load($comment->uid);
-        }
-        $output = '<div class="ignore-user-container">' . t('!username is on your <a href="!ignore_list">ignore list</a>. Click <a href="!comment" class="ignore-user-content-link">here</a> to view this post.', array('!username' => theme('username', $authors[$comment->uid]), '!ignore_list' => url('ignore_user/list'), '!comment' => url('node/' . $comment->nid . '#comment-' . $comment->cid)));
-        $output .= '<div class="ignore-user-content">' . $comment->comment . '</div></div>';
-        $comment->comment = $output;
-      }
-      break;
+  if (_ignore_user_ignored_user($comment->uid)) {
+    if (!$authors[$comment->uid]) {
+      $authors[$comment->uid] = user_load($comment->uid);
+    }
+    $markup = $build['comment_body'][0]['#markup'];
+    $output = '<div class="ignore-user-container">' . t('!username is on your <a href="!ignore_list">ignore list</a>. Click <a href="!comment" class="ignore-user-content-link">here</a> to view this post.', array('!username' => theme('username', array('account' => $authors[$comment->uid])), '!ignore_list' => url('ignore_user/list'), '!comment' => url('node/' . $comment->nid . '#comment-' . $comment->cid)));
+    $output .= '<div class="ignore-user-content">' . $markup . '</div></div>';
+    $build['comment_body'][0]['#markup'] = $output;
   }
 }
 

NitroPye’s picture

Is this module dead? Is it possible to get this patch included?

Deleet’s picture

Seems to be dead, but I was looking for a solution to the comment problem. I will try yours. Cheers for that. :)

Let me know if you can send me a complete installation, so I don't need to mess with the code myself. I'm not good at php. Email is: emil@emilkirkegaard.dk