All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

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: Adding Grid field to existing Channel Field Group causes MySQL error

Status Resolved
Add-on / Version Publisher 1.6.10
Severity
EE Version 2.10.2

Gavin Lawrie

Mar 12, 2016

Have created a channel.
Have defined a set of fields just for this channel as a channel field group.
Channel field group consists just of text and text area fields.
Go to publish new entry, and Entry screen in CP opens without problem.
Add a Grid field to the channel group (with text field as only column).
Go to publish a new entry, and get a MySQL error…

A Database Error Occurred

Error Number: 1054

Unknown column 'publisher_status' in 'where clause'

SELECT * FROM exp_channel_grid_field_176 WHERE publisher_status = "open" AND publisher_lang_id = 1 AND `entry_id` IN (0) ORDER BY `row_order` asc

Filename: third_party/publisher/models/publisher_query.php

Line Number: 110
#1

BoldMinded (Brian)

Have you tried this in an EE installation with only Publisher installed?

Find the Publisher_cp_events.php file and go to line 142 and add this die() statement, then create a new Grid field. It should print the text in the die statement.

https://www.dropbox.com/s/9w3ro4u6sr0gg0a/Screenshot 2016-03-13 10.15.04.png?dl=0

#2

Gavin Lawrie

Tried adding the die(‘hello’); entry and then adding a Grid field to the test channel. Grid field added no problem, didn’t see any output from the die statement. Then when trying to add entry to the channel with Grid field, get identical error to one posted before. Also confirm that if Grid field is removed again, you can add to channel no problem.

I’m sorry but don’t have unused EE instance to hand - so can’t easily to the testing of this on an EE with just Publisher installed.

If it helps to know, the add ons in use on the site are:

Modules: Assets, Category Construct, CE Cache, Detour Pro, Freeform Pro, Low Reorder, Low Search, NavEE, Stash, Subscriber, Wigwam. Extensions: CE Image, CE In, Low Seg2Cat, Publisher Low Search Support Fieldtypes: P+T Field Pack Plugins: CE Variables, Low Replace, Caddis Math, Minimee, Streeng, Switchee.

If it helps, happy to give you access to the server - it is a production machine, but the test channel being used doesn’t have any visibility etc.

#3

BoldMinded (Brian)

Ok then. You’ll need to try to replicate this in a new EE environment with just Publisher installed b/c it sounds like something is conflicting with it, either another add-on, or something on the server. The EE license says you can have as many development sites as necessary from the same license, so just take your original zip file, install it somewhere, then install Publisher and make some Grid fields and see if you get the same error. It should only take 15-30 minutes to do this.

#4

BoldMinded (Brian)

I just tried to replicate this locally and could not. The columns are added to the grid database table properly, thus no sql errors.

Another thing you could do is backup your database, then start uninstalling add-ons 1 at a time, then testing saving an entry. Once the error stops you’ll know which other add-on is causing a conflict, then I can take a look from there.

#5

Gavin Lawrie

Ok. I’ll dobthis but may take a while until I can set up the extra machine. In interim will see if I can just eliminate the need for additional grid fields - ones that are already defined work ok.

#6

Gavin Lawrie

Update:

I started removing the add ons that have been recently added first - on basis that since this used to work, something recent must have changed to cause problems. First I tried was one I didn’t realise was installed - TJ Drapers’ Ansel (I’d been beta testing it and thought it was removed, but it wasn’t). Removing it resulted in your “Die” clause firing when adding a new Grid Field (wasn’t happening before).

So I temporarily removed the Die clause and tried creating a new Grid field in the test channel, and got the same result.

I’ve reinstated the Die clause for now - any suggestions about next step now that this is being processed?

#7

BoldMinded (Brian)

Lets try this. Find the Publisher_grid.php file and add the var_dump and die as shown in the screenshot, then create a new grid field.

https://www.dropbox.com/s/d8b2njf6m44c49j/Screenshot 2016-03-14 07.56.33.png?dl=0

#8

Gavin Lawrie

Removed the die statement from Publisher_cp_events.php (else wise can’t add new field) and inserted the var_dump and die statements as per your suggestion in Publisher_grid.php.

Went to add a new Grid field: it was added no problem (no var dump, no die event).

go to add new entry in channel - same MySQL as before.

#9

BoldMinded (Brian)

What was the value of the var_dump()? It should have printed a db table name. Add the following var_dump and see what happens when you try to create an entry with the grid field (could be an existing field, don’t have to keep creating new fields now)

var_dump(ee()->db->table_exists($table_name), ee()->publisher_table->column_exists('publisher_lang_id', $table_name));

https://www.dropbox.com/s/ifp69xekhgvcrgp/Screenshot 2016-03-14 08.31.07.png?dl=0

#10

Gavin Lawrie

Maybe I’m missing something here - but the previous var_dump didn’t generate any apparent output, nor does this latest one.

I’ve recorded a short quicktime movie of what is going on - maybe this can help.

https://dl.dropboxusercontent.com/u/136373/Publisher-Grid-Adding.mov

#11

BoldMinded (Brian)

Comment out line 77 of that file that has the if (REQ … and see if it works after you do that.

#12

Gavin Lawrie

OK - will give it a go and report back.

In passing, found a work-around: I reinstalled Matrix, created a table in Matrix, then ran Kevin Cupp’s importer to create Grid equivalent and then deleted the Matrix field. Resulting Grid field works just fine. Not sure if this helps you understand what might be going at all - but maybe.

#13

Gavin Lawrie

Hi

Commenting out the line 77 results in weird error that kills the whole CP. Rather you get this output:

bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true)

Putting the line back fixes the problem.

#14

BoldMinded (Brian)

Did you comment out the other var_dump? If not do that and try it again.

#15

Gavin Lawrie

Doh! that’s the var_dump of course. So commented that out… and with the line 77 commented out can add grid fields and edit them no problem. But of course we’re back with the slow SQL queries from before:

0.1141   SHOW COLUMNS FROM `exp_channel_grid_field_146`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.1125   SHOW COLUMNS FROM `exp_channel_grid_field_122`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.1011   SHOW COLUMNS FROM `exp_channel_grid_field_123`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0837   SHOW COLUMNS FROM `exp_channel_grid_field_124`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0900   SHOW COLUMNS FROM `exp_channel_grid_field_147`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0923   SHOW COLUMNS FROM `exp_channel_grid_field_119`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.1090   SHOW COLUMNS FROM `exp_channel_grid_field_113`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0980   SHOW COLUMNS FROM `exp_channel_grid_field_115`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0947   SHOW COLUMNS FROM `exp_channel_grid_field_215`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0986   SHOW COLUMNS FROM `exp_channel_grid_field_144`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.1110   SHOW COLUMNS FROM `exp_channel_grid_field_145`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0928   SHOW COLUMNS FROM `exp_channel_grid_field_206`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()  
0.0969   SHOW COLUMNS FROM `exp_channel_grid_field_213`
#APP/third_party/publisher/libraries/Publisher/fieldtypes/Publisher_grid.php L:87  Publisher_table::column_exists()
#16

BoldMinded (Brian)

Ok, so change that if conditional that you commented out to if (REQ == ‘PAGE’) and give it a shot.

#17

Gavin Lawrie

Sorry - get the same error as before for newly created Grid Fields - so can create new fields in Channel Fields, but when you go edit an entry that contains the newly created field you get the 1054 error. As before, no problem editing / creating new entries with fields defined previously - it just affects the newly created field. Deleting the newly created field restores operation (eliminates the 1054 error) as before.

#18

BoldMinded (Brian)

Ok, I have enough to go on now I think. Thanks for the info. It may be a couple days before I have fix for this though.

#19

Gavin Lawrie

OK - good luck! If you need anything more in interim just let me know.

#20

BoldMinded (Brian)

I’m still unable to replicate this after creating 3 new Grid fields. At this point I’m going to have to ask that you do the clean EE install. Brand new setup with only Publisher installed, then try to replicate it.

Login to reply