Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-01-04 11:38:17

etc
Developer
Registered: 2010-11-11
Posts: 4,252
Website GitHub

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: 10,244
Website GitHub

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,252
Website GitHub

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: 10,244
Website GitHub

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
Multi-hyphenate
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,524
GitHub

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,252
Website GitHub

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: 10,244
Website GitHub

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,127
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

#21 2021-01-04 15:04:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,244
Website GitHub

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

jakob wrote #328021:

bot_wtc should continue to work because it just uses to jQuery to reposition the fields after they’ve been rendered.

Ah yes, that should be fine then.

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.

That’s what I thought and would likely be the main casualty of this ksort() approach. It’ll largely depend at what point the plugin hooks into the process. If it does it before Txp gets its mitts on things then the ksort() will likely override it. If, however, it’s a pluggable_ui() hook and just replaces the content at that point, we might be lucky as Txp should leave it alone.

Thanks in advance for testing.


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

#22 2021-01-04 17:27:00

etc
Developer
Registered: 2010-11-11
Posts: 4,252
Website GitHub

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

To test, but I’m pretty confident glz_cf does not alter get_prefs() function and goes the second way, via pluggable_ui().

Offline

#23 2021-01-05 12:45:53

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

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

Bloke wrote #328020:

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.

Just tried glz_custom_fields and bot_wtc with the current dev version (#44f395df) and ordering and shifting fields around works in both plugins.

Some other things need tending to:

  • bot_wtc needs the removal of a line that still uses get_magic_quotes(). Am I right in assuming doSlash() is no longer required?
  • glz_custom_fields needs a function trimming (only produces a warning during installation) but it could now also store its js and css files in the plugin folder, obviating the need to upload those separately.

TXP Builders – finely-crafted code, design and txp

Offline

#24 2021-01-05 13:50:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,244
Website GitHub

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

jakob wrote #328041:

Just tried glz_custom_fields and bot_wtc… shifting fields around works in both plugins.

Thank you so much for testing. Great to hear it works.

bot_wtc needs the removal of a line that still uses get_magic_quotes(). Am I right in assuming doSlash() is no longer required?

Still vital (unfortunately, until we use parametric queries or move to PDO) if you have any user input or stuff that’s read from prefs or tables or, well, anything that has the potential to be tampered with. So that line should become:

$item = doSlash($item);

glz_custom_fields needs a function trimming but it could now also store its js and css files in the plugin folder

Yes that’d be brilliant! And in 4.9.0 these bundled assets will show up in the list of things to be installed.


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