Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-06-28 12:51:04

mmelon
Member
Registered: 2006-03-02
Posts: 95

textpattern error adding new custom field after upgrade

Hi,

I’ve just super killed my textpattern.

I successfully updated to 4.5.7. Then when trying to add a new custom field (glz custom fields) I got an error that I missed. Something about a missing field index relating to the new custom field (custom_17).

Now when I try to access admin I get

internal_error “Unknown column ‘custom_17’ in ‘field list’”
in /home/****/public_html/textpattern/lib/txplib_db.php at line 95.
adminErrorHandler()
textpattern/lib/txplib_db.php:95 trigger_error()
textpattern/lib/txplib_db.php:296 safe_query()
textpattern/lib/txplib_misc.php(812) : eval()’d code:290 getRow()
textpattern/lib/txplib_misc.php(812) : eval()’d code:80 glz_article_custom_fields()
I’m sorry. I’m afraid I can’t do that. I think article create is no safe operation at this time.

Can I fix with phpmyadmin or otherwise?

Thx,
Mike

Offline

#2 2015-06-28 13:25:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: textpattern error adding new custom field after upgrade

mmelon wrote #292182:

Can I fix with phpmyadmin or otherwise?

glz_cf isn’t all that hot on keeping the field numbers up to date under certain circumstances (never tracked down why) but yes you can fix it. If you do (did) have custom_17 defined as a glz_cf and it’s not a column in your textpattern table then you can do one or more of:

  • Add it to the textpattern table, which of course won’t have any data associated with it.
  • Rename the column that does have the correct data in it to custom_17.
  • Alter txp_prefs (look for an entry with the name custom_N_set, where N is the field you want to check) and/or the custom_fields table which holds the CF options as defined in the admin interface.

The basic crux of doing any of the above is to tweak the values so everything aligns with how you want it to appear on the admin side. The three tables have to agree with one another on where to find stuff and which index (CF number) means what. Once everything is in check, your admin side will become functional again and you’ll be able to carry on as normal.

Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2015-06-28 13:28:59

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

if i wanted to add this field custom_17, how would i add it to the textpattern table? It looks like there is just articles in there.

There is a custom fields table, but that only has three CF’s defined. Not sure where the others are.

Thx for looking into it. Was quite worried!
Mike

Offline

#4 2015-06-28 13:35:06

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

ok i’ve added the row in the right place and it fixed the error. Something has gone awry in glz though. If I click edit field 17, it opens 16 and so on. It’s like field 17 didn’t add properly. Any ideas how I might fix that?

Appreciate your help!

Mike

Offline

#5 2015-06-28 13:38:17

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

actually it’s okay. It’s just the buttons that are out of alignment!!! oops

Offline

#6 2015-06-28 13:42:33

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

hmmn now when saving an article i get a popup with

internal_error “‘Array’ is not a string“in /home/****/public_html/textpattern/lib/txplib_misc.php at line 2689.adminErrorHandler()textpattern/lib/txplib_misc.php:2689 trigger_error()assert_string()textpattern/include/txp_article.php:217 array_map()textpattern/include/txp_article.php:66 article_save()

Offline

#7 2015-06-28 14:01:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: textpattern error adding new custom field after upgrade

mmelon wrote #292188:

hmmn now when saving an article i get a popup

Eeek, didn’t expect that. You refreshed your Write panel before trying to save, right? So it had a chance to redraw the UI with the new column IDs in.

If you inspect the page in Firebug or whatever and look at your custom field input widgets, do the custom-N numbers tie up with the columns in the three database tables textpattern, txp_prefs and custom_fields? And are all the custom_N columns in your textpattern table of type varchar(255) (with the exception of any that you have set to be textareas: they need to be of type text for the plugin to work).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2015-06-28 14:22:23

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

hmmn. I don’t think it’s related. It only seems to be doing it on one old article. When I made a new article and copied the content over, it was fine until I set the name and the url title to the same as the problematic one, then it broke with the same error! bizarre. I’m still trying to figure out what causes it.

Offline

#9 2015-06-28 14:25:09

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: textpattern error adding new custom field after upgrade

mmelon wrote #292194:

until I set the name and the url title to the same as the problematic one

By any chance, the name of your custom field isn’t on the reserved list is it? Clashing with a Txp internal variable name?

Second thoughts, it’s not that, since it was working before and that would affect all other articles too. Hmmm… must be something odd with that particular article compared with the others.

Last edited by Bloke (2015-06-28 14:30:37)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2015-06-28 14:37:15

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

actually it is caused by the new custom field. If it’s a select and i touch the control, the page won’t save with the above error. If it’s a multiselect and i touch the control, the page won’t save. If I open the article and don’t touch the control, it does seem to save.

There is no mention of custom fields in my txp prefs table.

the others seem okay http://www.colourfusion.co.uk/stef.png

One thing I did notice, trying to add another custom field, after i deleted custom_17 and tried to add again via the glz extension panel, caused the mega error again,

Mike

Offline

#11 2015-06-28 14:45:49

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: textpattern error adding new custom field after upgrade

weirder.

If I take the ‘[]’ off the name attribute it posts and saves. That’s what’s causing it

<select id=“custom-17” name=“custom_17[]” class=“list” multiple=“multiple” size=“5”><option value=”“>&nbsp;</option><option value=“visible-xs” selected=“selected”>visible-xs</option><option value=“visible-sm”>visible-sm</option><option value=“visible-md”>visible-md</option><option value=“visible-lg”>visible-lg</option></select>

it does it on my previous custom fields that have brackets in the name attribute like:

<input type=“checkbox” name=“custom_14[]” value=“tick to add noindex,nofollow” class=“checkbox” id=“tick-to-add-noindexnofollow”>

Do I have an out of date GLZ?

Mike

Offline

#12 2015-06-28 14:49:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: textpattern error adding new custom field after upgrade

mmelon wrote #292196:

There is no mention of custom fields in my txp prefs table.

Even if you issue select * from txp_prefs where event = 'custom'? As far as I’m aware, there needs to be an entry in there for every field you have defined, with name custom_N_set and a value of the field’s human-readable title.

The other tables look fine to me.

One thing I did notice, trying to add another custom field, after i deleted custom_17 and tried to add again via the glz extension panel, caused the mega error again,

Yeah, I’ve spotted this before in glz_cf. I think it’s when you get “holes” in your index numbers, when some are missing, it sort of tries to insert them in the gap and screws something up. As I say, never really got to the bottom of it, sadly.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB