MySite throws an error when there is no content on the page. It doesn't happen 100% of the time, but it usually does. It happens when there's default content that's all deleted by the user, and when there's no default content.

This is the error:
warning: Invalid argument supplied for foreach() in [site]/public_html/modules/mysite/plugins/layouts/default.php on line 29.

I'm not sure exactly why that error appears, but if it's not really used for anything I feel like it should just cause the "you haven't added content to this page yet..." text to show up.

Is the 5.x-3.0B3 version stable yet? If so, I might consider using that instead. I'm running a production site but it's a startup (my first of this magnitude) and I didn't launch with a user base so there are only some 10 users on the site right now. (Note to self: don't do that next time. ;) )

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

5.x3-beta3 had some bugfixes. HEAD should be stable, but I have not had enough testers in order to confirm that it can be released. So testing HEAD would be greatly appreciated. I can't release until people test.

Back to this bug. Let me make sure I understand.

-- The admin sets default content.
-- A user creates MySite page.
-- The default content is placed on the user MySite page.
-- User then deletes all content.
-- User goes to 'mysite/UID' and gets and error.

Correct? We have fixed some variant of this bug at least 5 times, so I need to know precisely the situation.

-- Who is viewing the page? The owner? An anonymous user?

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)
FileSize
49.59 KB
13.82 KB

Here's what I did:

-- Set default content items.
-- Created a new user MySite page.
-- Deleted all content from the user 'View' page.

No errors. Screenshot attached (picture 2).

-- Added content again.
-- Deleted all content from the user 'Content' page.

Again, no errors. (picture 3).

Are you certain that you are using the latest release?

agentrickard’s picture

Most recent release should have this at the top of the CHANGELOG.txt:

CHANGELOG
========

20-JAN-2008
  -- #210510. Partial change to droplet.inc for killes, to show the originating block or view data.
      We need to make this a link to the original.
  -- #208887 by atuyo60.  Incorrect use of t() in theme_mysite_submenu() causes
      errors for non-English translations.
  -- The following bugs are all related to changes in mysite_get_includes() and improper
      use of static variables.
    -- #208895 by atuyo60
    -- #208276 by relkiman
    -- #208610 by LouBabe
  -- Fixes mysite_load_includes() to throw a warning when no includes are active.
  -- Fixes an issue where content pages for disabled includes could still be loaded.   
  -- Creates the 5.x.2.17 release
IceCreamYou’s picture

FileSize
47.96 KB

It is the newest version of the 2.x branch, and has the text in the changelog that you indicated.

I have noticed this error twice.

The first time, I (the admin) had set no default content, and an authenticated user got the error each time he viewed his mysite page until content was added.

The second time, I had set default content. An authenticated user then edited his mysite page (for the first time--it started with the default content) and removed all content from the page. Upon doing so, he was taken to a screen that looks similar to your Picture 2.jpg. However, on refresh, the page showed up like the attachment to this post. This result was achieved both by deleting content from the View tab, and by deleting content from the Content tab.

If it would help, I can email you the username and password for a test user so you can try it yourself if you can't duplicate the results on your own.

agentrickard’s picture

Tried again on a different machine with a totally fresh install of the 5.x.2.17 module.

Cannot replicate; everything works as expected.

Do you have Drupal's cache turned on? MySite's cache turned on?

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Active

It seems to be the MySite cache that is the problem. Disable it for now while I find a solution.

agentrickard’s picture

Patch coming shortly.

agentrickard’s picture

Title: Error when no content » Error when no content and using MySite cache
agentrickard’s picture

Status: Active » Fixed
FileSize
3.16 KB

This bug has apparently been around since the first release, and you're the first person to catch it.

The information about "second page load" was crucial in figuring this out.

Patch attached, committed to HEAD. Give yourself a gold star!

IceCreamYou’s picture

Haha. Thank you for making it work! This is a great module.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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