Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Deleting a matrix row does not delete the data.

Status Resolved
Add-on / Version Publisher Lite 1.0.1
Severity Trivial
EE Version 31
Images

Re-Open Ticket

Peter McDonagh

Jul 12, 2013

hi Brian,

I’m not sure whether this is a matrix bug or something related to publisher lite.

In a matrix table that has more than 1 row, if i delete a row, using the “Delete row” link in the matrix left hand side dropdown menu, and then save as published, it does not remove the row. If i go back into the entry, it is still there.

I can work around it right now it by just deleting the content within the row, and then letting matrix delete the entire row when saving, - it seems to work, but long-term, this will cause potential issues for my client.

You can test it yourself - I’ve set up a test row -
Log in
go to Content > Edit > Expertise > Aviation…

Under “Recommendations”, you will see “TEST ROW / TEST ROW CONTENT” in row 2.

I’m running matrix 2.5.4

thanks again
pete

 

#1

BoldMinded (Brian)

I can replicate it in my dev sandbox too. I’ll look into it this weekend.

#2

BoldMinded (Brian)

I think I have a fix. Open up the libraries/Publisher/fieldtypes/Publisher_matrix.php file and go to line 96 or so and you’ll see

// Return unmodified data
return $data;

Just before that add this:

// Finally, handle deleted rows.
$field_data = $_POST['field_id_'.$this->field_id];

if (isset($field_data['deleted_rows']) && !empty($field_data['deleted_rows']))
{
    foreach ($field_data['deleted_rows'] as $row)
    {
        $where['publisher_status'] = $this->publisher_save_status;
        $where['row_id'] = str_replace('row_id_', '', $row);
        ee()->db->where($where)->delete('matrix_data');
    }
}

// Return unmodified data
return $data;

Let me know if that works for you.

#3

Peter McDonagh

Hi Brian,

I’ve made that update, and while it does now delete the row, I’m seeing a flash of php errors after clicking “Publish” and just before the result page:


A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_7

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_9

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_11

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_12

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_72

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_73

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97 A PHP Error was encountered

Severity: Notice

Message: Undefined index: field_id_74

Filename: fieldtypes/Publisher_matrix.php

Line Number: 97


#4

BoldMinded (Brian)

Change line 97 to this

$field_data = isset($_POST['field_id_'.$this->field_id]) ? $_POST['field_id_'.$this->field_id] : array();
#5

Peter McDonagh

yes, thats done it, perfect! thanks again pete

Login to reply