Getting a slew of notice: Undefined index: title in /.../sites/all/modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148. for each views field. No clue why.

Michelle

Comments

michelle’s picture

The line in question is:

$variables['rows'][$num][$column] .= $field_output;

and the page appears to be working just fine. All the rows are showing up. Very strange.

Michelle

michelle’s picture

Title: Undefined index notices in topic list view » Fix notices

Changing this to a more generic issue.

/forum

  • notice: Undefined property: ctools_context::$parents in /home/.../modules/advanced_forum/plugins/content_types/forum_list.inc on line 43.
  • notice: Undefined property: ctools_context::$parents in /home/.../modules/advanced_forum/plugins/arguments/forum_id.inc on line 88.

/forum/container

  • notice: Undefined property: stdClass::$num_posts in /home/.../modules/advanced_forum/includes/advanced_forum_preprocess_forum_list.inc on line 121.

/forum/forum

  • notice: Undefined offset: 0 in /home/.../modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148.
  • notice: Undefined index: comment_count in /home/shellmul/.../modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148.

/forum-node

  • notice: Undefined index: op in /home/...modules/advanced_forum/includes/advanced_forum_preprocess_node.inc on line 28.
  • notice: Undefined variable: top_post in /home/.../modules/advanced_forum/styles/naked/advanced_forum.naked.post.tpl.php on line 25.
  • notice: Undefined variable: page_link in /home/.../modules/advanced_forum/styles/naked/advanced_forum.naked.post.tpl.php on line 53.
  • notice: Undefined variable: top_post in /home/.../modules/advanced_forum/styles/naked/advanced_forum.naked.post.tpl.php on line 100.
  • notice: Undefined variable: top_post in /home/.../modules/advanced_forum/styles/naked/advanced_forum.naked.post.tpl.php on line 52.

These are AP related but sticking them here for now:

  • notice: Trying to get property of non-object in /home/.../modules/facebook_status/facebook_status.author-pane.inc on line 21.
  • notice: Trying to get property of non-object in /home/.../modules/facebook_status/facebook_status.module on line 154.
michelle’s picture

Updated list:

/forum

  • notice: Undefined property: ctools_context::$parents in /home/.../modules/advanced_forum/plugins/content_types/forum_list.inc on line 43.
  • notice: Undefined property: ctools_context::$parents in /home/.../modules/advanced_forum/plugins/arguments/forum_id.inc on line 88.

Code:

  if ($forums) {
    $block->content = theme('forum_list', $forums, $context->parents, $tid); // <---- Line 43

    if (user_access('administer forums')) {
      $block->admin_links['administer_forums'] = array(
        'title' => t('Administer forums'),
        'alt' => t("Add, delete or modify forums"),
        'href' => "admin/content/forum",
      );

      if ($tid) {
        $block->admin_links['edit_forum'] = array(
          'title' => t('Edit forum'),
          'alt' => t("Modify this forum"),
          'href' => "admin/content/forum/edit/" . ($context->data->container ? 'container/' : 'forum/') . $tid,
          'query' => drupal_get_destination(),
        );
      }
    }
  }
  return $block;
}
  if ($context->parents) { // <------ Line 88
    $parents = array_reverse($context->parents);
    foreach ($parents as $p) {
      if ($p->tid != $context->data->tid) {
        $breadcrumb[] = l($p->name, 'forum/' . $p->tid);
      }
    }
  }

/forum/individual_forum

  • notice: Undefined offset: 0 [also 1-5] in /home/.../modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148.
  • notice: Undefined index: comment_count [also topic_icon, title, etc] in /home/shellmul/.../modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148.

Code:

    // Render each field into its appropriate column.
    foreach ($result as $num => $row) {
      if (!empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
        $field_output = $renders[$num][$field];

        if (!isset($vars['rows'][$num][$column])) {
          $vars['rows'][$num][$column] = '';
        }

        // Don't bother with separators and stuff if the field does not show up.
        if ($field_output === '') {
          continue;
        }

        // Place the field into the column, along with an optional separator.
        if ($vars['rows'][$num][$column] !== '') {
          if (!empty($options['info'][$column]['separator'])) {
            $variables['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
          }
        }

        $variables['rows'][$num][$column] .= $field_output; // <----- This is the trouble line
troky’s picture

notice: Undefined index: comment_count [also topic_icon, title, etc] in /home/shellmul/.../modules/advanced_forum/includes/template_preprocess_advanced_forum_topic_list_view.inc on line 148

It look's like messing $vars with $variables.

<?php

        // Place the field into the column, along with an optional separator.
        if ($vars['rows'][$num][$column] !== '') {
          if (!empty($options['info'][$column]['separator'])) {
            // $variables['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
            $vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
          }
        }

        // $variables['rows'][$num][$column] .= $field_output; // <----- This is the trouble line
        $vars['rows'][$num][$column] .= $field_output;
?>
michelle’s picture

Huh... Sure enough. I use $variables, not $vars and missed that. Wonder how it's working at all with a goof like that? LOL! Thanks for seeing it.

Michelle

michelle’s picture

That was odd. After fixing this, I had an extra line between the last comment author and last comment time. Turns out I had been compensating for the bug without realizing it and had to go remove the extra br from the field rewrite in the views.

Committed that fix, thanks.

Leaving this active because I don't have notices on at the moment to see if any of the other ones are still there.

Michelle

michelle’s picture

Status: Active » Fixed

Got them all fixed at the moment. Will check periodically to make sure I didn't add new ones.

Michelle

Status: Fixed » Closed (fixed)

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