Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#11 2021-01-04 11:08:09
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,076
- Website
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: 9,994
- Website
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
#13 2021-01-04 11:38:17
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,076
- Website
Re: Field test request - custom fields order on Write panel
It looks like on prefs panel we grab them directly and
ORDER BY sort_value = 0, sort_value, event, position
Offline
#14 2021-01-04 11:58:30
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,994
- Website
Re: Field test request - custom fields order on Write panel
etc wrote #328014:
It looks like on prefs panel we grab them directly
So maybe getCustomFields()
is using faulty sort logic? Or no sort logic?
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
#15 2021-01-04 12:07:06
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,076
- Website
Re: Field test request - custom fields order on Write panel
Bloke wrote #328015:
So maybe
getCustomFields()
is using faulty sort logic? Or no sort logic?
It just extracts all [custom_\d+_set]
values from $prefs
and does not sort them any further. I guess the right sort order should be position
, but it is not available in $prefs
.
Offline
#16 2021-01-04 12:43:59
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,994
- Website
Re: Field test request - custom fields order on Write panel
etc wrote #328016:
does not sort them any further. I guess the right sort order should be
position
, but it is not available in$prefs
.
Drat. You’re right. That’ll be the issue. Not sure why it changes in this instance. Might be database related. We could live with it and ensure we have a way to set the order of CFs in 4.9 unlimited CFs (drag/drop/whatever) then the order doesn’t matter so much as it’s configurable.
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
#17 2021-01-04 13:12:24
- gaekwad
- Admin
- From: People's Republic of Cornwall
- Registered: 2005-11-19
- Posts: 3,349
Re: Field test request - custom fields order on Write panel
Bloke wrote #328017:
Might be database related. We could live with it
Honestly, if it’s taken this long for it to crop up in real life, I’m certain we can cope in the meantime!
Offline
#18 2021-01-04 13:19:15
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,076
- Website
Re: Field test request - custom fields order on Write panel
It takes just a numeric ksort
to fix it in core. But I don’t know how various WTC plugins would react. Curious to see?
Offline
#19 2021-01-04 14:42:51
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 9,994
- Website
Re: Field test request - custom fields order on Write panel
etc wrote #328019:
It takes just a numeric
ksort
to fix it in core. But I don’t know how various WTC plugins would react. Curious to see?
I expect they’ll break spectacularly, but user testing will confirm!
Anyone with access to bot_write_tab_customize and glz_custom_fields, please test the bleeding edge 4.8.5 to see if the custom fields order can still be customised, or if this changes stomps over it.
Thank you.
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
#20 2021-01-04 14:49:20
- jakob
- Admin
- From: Germany
- Registered: 2005-01-20
- Posts: 4,035
- Website
Re: Field test request - custom fields order on Write panel
I’ve not tried either just yet, but …
if it doesn’t affect the ids/names of the custom fields, then bot_wtc should continue to work because it just uses to jQuery to reposition the fields after they’ve been rendered.
It might have an effect on the output of the fields in glz_cf though because IIRC it does use the position
field to determine the order in which they are output.
TXP Builders – finely-crafted code, design and txp
Offline