Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-01-02 16:45:30

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Field test request - custom fields order on Write panel

I stumbled across an…interesting…issue with recent Textpattern on PHP 7 and PHP 8 with Percona database. I would be most grateful if you could take a moment to test this on your Textpattern if it’s viable.

Here’s the issue: github.com/textpattern/textpattern/issues/1621 – in short: the custom field sort order is reversed…but custom field 7 appears first in the list if it is set.

If you have a production site that uses custom fields, do not change the names unless you know exactly how to set them back. This is important, it’s not worth breaking your front-end site for.

If you do not use custom fields, please set each field value to its number, like this:

Save your changes, and then go to the Write panel and expand the Custom Fields area. Note the sort order, like this:

  • What version of Textpattern and PHP are you using? What database vendor and version are you using?
  • What order do the custom fields appear in for you ? Ascending? Descending?
  • Does custom field 7 appear first?

Offline

#2 2021-01-02 17:00:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Field test request - custom fields order on Write panel

txp 4.8.4, PHP: 7.4.10, MySQL: 5.7.28. All looks fine


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2021-01-02 17:04:25

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Field test request - custom fields order on Write panel

Thanks, Yiannis – can you check the article custom fields area to see if you get the fields in the expected order, please?:

Offline

#4 2021-01-03 00:47:15

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Field test request - custom fields order on Write panel

TXP 4.8.4 + PHP 7.4.11 + MySQL 5.7.28

All custom fields are listed in the expected order (freshly created: 5,6,7,8,9,10) the other ones (existing/active/in use) are listed as set – first custom field set in the prefs comes first etc.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#5 2021-01-03 04:59:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Field test request - custom fields order on Write panel

Same as it ever was:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2021-01-03 09:12:44

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Field test request - custom fields order on Write panel

I did a test on a locally hosted site, TXP4.8.4, PHP 7.3.*, MySql 8.0. With and without the gls_customfields plugins.

In both cases the custom fields are sorted as inputted.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2021-01-04 02:41:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Field test request - custom fields order on Write panel

Here is some weirdness on that MySQL 8 local site

After disabling the glz_customfields plugin, yesterday all fields where still correctly ordered (Write panel, Preferences Panel > Custom fields). Today I edited some of those custom fields. After saving (I did not notice anything wrong but to be honest was not paying enough attention) I visited the Write tab where everything was listed correctly (custom_field_1 in the 1st place, custom_field_10 last, everything in between listed as expected).

But then I (revisited) the Preference panel – custom fields was still the selected tab – the order was out of whack: 1, 3, 2, 5, 6, 7, 8, 9,10, 4. Custom fields 4 – 10 had been edited.

Looking at the DB, txp_prefs table:

custom_1_set	page_id	0	custom	text_input	0	
custom_2_set	stylesheet	0	custom	text_input	2	
custom_3_set	colour	0	custom	text_input	1	
custom_4_set	4	0	custom	text_input	999	
custom_5_set	5	0	custom	text_input	5	
custom_6_set	6	0	custom	text_input	6	
custom_7_set	7	0	custom	text_input	7	
custom_8_set	8	0	custom	text_input	8	
custom_9_set	9	0	custom	text_input	9	
custom_10_set	10	0	custom	text_input	10	

note the last column (position).

Fun times…


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2021-01-04 09:36:45

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Field test request - custom fields order on Write panel

custom text_input 999

A very vague thought: I seem to remember that the drag and drop script in glz_custom_fields could produce the 999 when there was a glitch sorting/adding a new custom field but I can’t immediately identify where that happens in the code.


TXP Builders – finely-crafted code, design and txp

Offline

#9 2021-01-04 10:10:51

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Field test request - custom fields order on Write panel

Jacob, hmm, yes it is possible I dragged and dropped that CF, it was a while ago I used them, TBH. Similarly, the position of CF2 [2] and CF3 [1] may be related to drag and drop.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#10 2021-01-04 10:19:06

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Field test request - custom fields order on Write panel

In a vanilla, plugin-free dev install, the database sort order is as expected:

(I’ve added the ‘custom*’ names for 3 to 10, to be clear.)

Offline

#11 2021-01-04 11:08:09

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Field test request - custom fields order on Write panel

That’s what is in public-side $prefs when logged out:

  'custom_7_set' => 'custom7',
  'override_form_types' => 'article',
  ...
  'custom_10_set' => 'custom10',
  'custom_9_set' => 'custom9',
  'custom_8_set' => 'custom8',
  'img_dir' => 'images',
  'custom_6_set' => 'custom6',
  'custom_5_set' => 'custom5',
  'custom_4_set' => 'custom4',
  'custom_3_set' => 'custom3',
  'custom_2_set' => 'custom2',
  'custom_1_set' => 'custom1',

When logged in, the order is normal. Clearly, the order of the array returned by get_prefs() depends on its arguments ($user): get_prefs() is weird, get_prefs(array('', $txp_user)) works fine. Internally txp_prefs table is sorted by

ORDER BY FIELD(user_name, '', 'current_user')

which does not necessary respect the ‘natural’ db order.

Offline

#12 2021-01-04 11:25:55

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

Re: Field test request - custom fields order on Write panel

etc wrote #328012:

Clearly, the order of the array returned by get_prefs() depends on its arguments ($user)

Weird. Then why does it show up fine in the Prefs panel but wonky on the Write panel in Pete’s case? Are we overriding the sort order somehow in the Write panel list? Or are we extracting the custom fields directly instead of via get_prefs()? I forget how we grab them. getCustomFields() if memory serves.

Last edited by Bloke (2021-01-04 11:27:05)


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

Online

Board footer

Powered by FluxBB