I started to learn drupal yesterday and now I started to set up one forum, creating the containers and forums.
I went to the Forums menu and get one warning message warning: Invalid argument supplied for foreach() in /drupal/modules/forum/forum.module on line 679.

I think this isn't a critical "bug", but the solution is very simple.

I made a little hack on forum.module
Before the

foreach ($vocabulary->nodes as $type)

added one exception, if there are no nodes then don't run the foreach

	if (count($vocabulary->nodes))
    foreach ($vocabulary->nodes as $type) {
      // Check if the current user has the 'create' permission for this node type.
      if (node_access('create', $type)) {
        // Fetch the "General" name of the content type;
        // Push the link with title and url to the array.
        $forum_types[$type] = array('title' => t('Post new @node_type', array('@node_type' => node_get_types('name', $type))), 'href' => 'node/add/'. str_replace('_', '-', $type) .'/'. $variables['tid']);
      }
    }

Comments

mjrider’s picture

I couldn't get this to fix my problem