Notice: Undefined index: group by in quiz_views_handler_filter_quiz_nid->construct() (line 46 of ...\quiz\includes\views\handlers\quiz_views_handler_filter_quiz_nid.inc).

The group_by property is not initalized.

I try to change these codes to solve this problem:

function construct() {
    parent::construct();
    /*
     *  $this->vid_field = !empty($this->definition['vid field']) ? $this->definition['vid field'] : 'vid';
    $this->group_by = $this->definition['group by'];
    if (!empty($this->definition['secondary group by'])) {
      $this->secondary_group_by = $this->definition['secondary group by'];
    }
     */
  }

--> AND Add function :

function init(&$view, &$options) {
      parent::init($view, $options);
      $this->vid_field = !empty($this->definition['vid field']) ? $this->definition['vid field'] : 'vid';
    $this->group_by = $this->definition['group by'];
    if (!empty($this->definition['secondary group by'])) {
      $this->secondary_group_by = $this->definition['secondary group by'];
    }
  }
----------
System :
Drupal 7.16
My SQL: 5.1
PHP 5.2.8
Apache 2.2
Windows 7 Pro 64 bits.

Comments

If you add:

<?php
if(!empty($this->definition['group by'])) {
 
$this->group_by = $this->definition['group by'];
}
?>

to quiz\includes\views\handlers\quiz_views_handler_filter_quiz_nid.inc - it'll fix that error.

Would love to know what line to add that there code to!

Thanks!

@A Romka, Tried to add your code at line 47 but no joy. Error persists.
Where should the code go?

Never mind. Moved the code to line 46 and that 'sorts' the issue out.
This works for 7x-4.0-alpha12

UPDATE:
Spoke too soon, the error reappears now at line 49. So help still requested.

you need to change:

$this->group_by = $this->definition['group by'];

to:

if(!empty($this->definition['group by'])) {
  $this->group_by = $this->definition['group by'];
}

Version:7.x-4.0-alpha11» 7.x-4.x-dev
Status:Active» Needs review
StatusFileSize
new1.25 KB

Patch attached.

StatusFileSize
new873 bytes

Sorry, this is the correct patch. The previous one had another patch with it.

Thanks A Romka! Seems to be working like a charm.

Thanks A Romka works fine +1 to #5.

Patch #7 working good.

Status:Needs review» Fixed

Patch committed to git. Thanks.

Status:Fixed» Closed (fixed)

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

Issue summary:View changes

Change format code

  • Commit 784b108 on 7.x-4.x, 7.x-5.x by sivaji: Issue #1827880 by Mohammed J. Razem | memberall: Fixed Undefined index:...