Hi,
I'm using Drupal 5.1.

I'av installed the laste Beta version of the module : mysite-5.x-2.0-beta2, but i'va an error in the view page.
this is the error : warning: Invalid argument supplied for foreach() in ......\modules\mysite\plugins\layouts\default.php on line 41.
Please can you help me:)

Comments

agentrickard’s picture

Title: Bug in mysite-5.x-2.0-beta2 » Empty array passed to layout file
Assigned: Unassigned » agentrickard
Status: Active » Fixed

This was caused by passing an empty array if the user had no content in their collection.

The fix is to check the incoming data array before calling the layout file.

Lines 604+ of mysite.module change from:

    if ($pageview) {
      print theme('mysite_'. $mysite->layout .'_layout', $content);
      return;
    }

to

    if ($pageview) {
      if (!empty($data)) {
        print theme('mysite_'. $mysite->layout .'_layout', $content);
      }
      else {
        global $_mysite_menu;
        $_mysite_menu = mysite_content_menu();      
        drupal_set_message(t('You have no content saved.'));
        $output .= theme('mysite_content_help', $owner);
        print theme('page', $output, variable_get('mysite_fullscreen', 1));
      }
      return;
    }

This is patched and RTBC.

agentrickard’s picture

Status: Fixed » Active

Not quite fixed. Investigating.

agentrickard’s picture

Status: Active » Fixed

The was a logic error in mysite_content_add() as well.

Change line 1713 from:

      $position = count($layout['regions']);

to:

      $position = count($layout['regions']) - 1;

RTBC.

agentrickard’s picture

Status: Fixed » Closed (fixed)

Committed to HEAD and rolled into beta3