My setup:
drupal 5.7
flag_content 2.5
Flag_content is turned on for some node types and comments, but disabled for users.

When viewing a user's profile, i get the following error:

warning: Invalid argument supplied for foreach() in /mnt/hgfs/trunk/modules/user/user.module on line 1527.

hook_user chokes when the $items variable in the code below is empty.

The following patch fixed it for me. It only sends data back to hook_user if there's something in $items. Patch Needs review:

Index: flag_content/flag_content.module
===================================================================
--- flag_content/flag_content.module (revision 807)
+++ flag_content/flag_content.module (revision 839)
@@ -133,5 +133,9 @@
         );
       }
-      return array(t('Flag user') => $items);
+      
+      if (is_array($items)) {
+        return array(t('Flag user') => $items);        
+      }
+      break;
 
     case 'delete':

Comments

kbahey’s picture

Version: 5.x-2.5 » 5.x-2.6
Status: Needs review » Fixed

Thanks. Fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.