Errror message when trying to create new content -- warning: Invalid argument supplied for foreach()...

jmunning - June 10, 2009 - 18:17
Project:Domain Access
Version:5.x-1.10
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

On my production site I am getting an error message whenever I try to add content on my primary site. Any ideas how I could get rid of or suppress this error?

warning: Invalid argument supplied for foreach() in D:\WEB\FacultyLounge\nonmajors\sites\all\modules\domain\domain.module on line 1087.

#1

agentrickard - June 10, 2009 - 18:44

Did you install this on an existing site? It looks like your users are not assigned to any domains.

Either assign your users to domains or edit the file:

        if (!isset($user->domain_user)) {
          $user->domain_user = array();
        }
        foreach ($user->domain_user as $key => $value) {
          if (abs($value) > 0) {
            $user_domains[] = $value;
          }
        }

5.x.1.9 is no longer supported, but if you users are not assigned to domains, you will have this problem in 5.x.10 as well.

Considering that you are trying to show users their domain options, it is tempting to call this configuration error rather than bug.

#2

jmunning - June 10, 2009 - 22:03

Hi agentrickard,

Thanks for the help. I did install on an existing site. My understanding was that existing users would be assigned to the primary domain by default but now I can't find that info in the README so maybe I misunderstood. Is there an easy way to assign all existing users (I have over 2000) to the primary domain?

I didn't realize 5.x.10 was out, I will update.

Thanks.

#3

agentrickard - June 11, 2009 - 13:53
Version:5.x-1.9» 5.x-1.10
Category:support request» bug report

There is not an easy way in the D5 version; this is just serialized data stored in the {users} table. Better to add the error-handling code as a patch.

Even better to add a domain_enable() routine to update the {users} table.

#4

agentrickard - June 13, 2009 - 18:18
Status:active» fixed

Proper patch. Committed to 5.x branch.

AttachmentSize
487842-user-array.patch 771 bytes

#5

agentrickard - June 13, 2009 - 18:33

I thought about this, and this is probably the proper patch. However, new users are auto-assigned to the domain from which they registered. So we probably need a form to assign users to domains.

#6

agentrickard - June 13, 2009 - 18:35

#7

System Message - June 27, 2009 - 18:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.