Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: glz_custom_fields v2 beta for Textpattern v4.7
It seems I just ran into a bug that I would like to describe here and see if somebody can reproduce or even solve it.
I have multiple custom_fields as teaxtareas and some textinputs as well.
When I am saving the article it duplicates the textareas (and sometimes their entries) so that I see clones of the textarea in my write pane. When reloading the page it disappears.
I am testing in 4.8.5.
EDIT: Sorry. I just found out, the problem is related to the plugin write_tab_customize. It only appears when custom fields are textareas and move to a different position via this plugin.
Last edited by demoncleaner (2021-05-09 07:29:16)
Offline
#92 2021-05-09 22:28:40
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: glz_custom_fields v2 beta for Textpattern v4.7
demoncleaner wrote #330073:
When I am saving the article it duplicates the textareas (and sometimes their entries) so that I see clones of the textarea in my write pane. When reloading the page it disappears.
Have you installed glz_custom_fields_v2.0.1?
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
Have you installed glz_custom_fields_v2.0.1?
yes
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
demoncleaner wrote #330073:
When I am saving the article it duplicates the textareas (and sometimes their entries) so that I see clones of the textarea in my write pane. When reloading the page it disappears.
EDIT: Sorry. I just found out, the problem is related to the plugin write_tab_customize. It only appears when custom fields are textareas and move to a different position via this plugin.
Both plugins originate from an era before the Ajax-based saving on the write tab. In those days the entire tab was reloaded and glz_cf and bot_wtc would then do their additions/changes on page load (bot_wtc also when the section drop-down is changed). Over the years, various people have patched the plugin to keep up with changes in the Textpattern interface but as you say there are problems when custom fields lie outside the custom fields panel when the Ajax-update refreshes that section.
I guess bot_wtc should be triggered again on ajax-save to ditch any ‘stale‘ custom fields outside the custom fields block and replace them with their ‘fresh’ replacements from the custom fields block. I don’t have the time to investigate this just now but the plugins are both on GitHub and you’re welcome to fork them: glz_custom_fields and bot_wtc.
TXP Builders – finely-crafted code, design and txp
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
Thanks for the explanation of the origin of its behavior. I will try to fix it.
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
with PHP 8.1 the plugin seems to work in my basic tests (I don’t use it much beyond a set of radios here or there).
Some noise and complains (admin side): github.com/jools-r/glz_custom_fields/issues/7
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
Working with glz v2.01 here on txp 4.8.8.
How could i split multiple entries in a multi-select custom field into a list of accessible single entries? I want to use those as search terms, or to order them whatever way possible?.
Example
I have multiple articles of – say – restaurants.
A multi-select custom field called “opening times” contains all days of the week, one per line.
Now what i need to construct is a script, that would let me see only the articles/restaraunts open for instance on Monday.
I can’t seem to be able to do this. I use rah_replace to change the divider between entries just for display, however the results can’t seem to be used as variables or search criteria, as i get no index of what rah_replace found.
How can i approach this? Any hints welcome and thank you in advance!
Last edited by jayrope (2022-02-04 21:51:49)
A hole turned upside down is a dome, when there’s also gravity.
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
Can you not use the power of if_custom_field?
<if::custom_field name="opening_times" separator="," match="any" value="monday">
Hello company that's open on a Monday!
</if::custom_field>
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: glz_custom_fields v2 beta for Textpattern v4.7
Bloke wrote #332650:
Can you not use the power of if_custom_field?
<if::custom_field name="opening_times" separator="," match="any" value="monday">...
Thanks, Bloke :* Wouldn’t this mean i need seven of those, if i only want to display any possible weekday option on a result page?
Let’s assume, that Monday as well as any other weekday is a clickable word in a list, that leads me to a list of articles, which have been marked like this: How do i get this list at all, in an automated way.
Last edited by jayrope (2022-02-04 21:54:15)
A hole turned upside down is a dome, when there’s also gravity.
Offline
#100 2022-02-05 10:34:06
Re: glz_custom_fields v2 beta for Textpattern v4.7
jayrope wrote #332652:
Let’s assume, that Monday as well as any other weekday is a clickable word in a list, that leads me to a list of articles, which have been marked like this: How do i get this list at all, in an automated way.
Not sure for glz_cf, but try accessing
<txp:article match="opening_times" />
via index.php?opening_times=%monday%
Offline
#101 2022-02-05 19:01:46
Re: glz_custom_fields v2 beta for Textpattern v4.7
etc wrote #332656:
Not sure for
glz_cf, but try accessing
<txp:article match="opening_times" />...via
index.php?opening_times=%monday%
Thank you, etc. I guess i haven’t explained properly. The first thing i needed to do is to extract each marked single entry from a multi-select glz_cf custom field. If i had those, one by one in an array of all, then i could actually access them for either your or Bloke’s option. I fail to be able to create that array, though…
A hole turned upside down is a dome, when there’s also gravity.
Offline
#102 2022-02-05 19:16:55
Re: glz_custom_fields v2 beta for Textpattern v4.7
jayrope wrote #332661:
Thank you, etc. I guess i haven’t explained properly. The first thing i needed to do is to extract each marked single entry from a multi-select glz_cf custom field. If i had those, one by one in an array of all, then i could actually access them for either your or Bloke’s option. I fail to be able to create that array, though…
I’ve not tried etc’s suggestion but it sounds like it could work without you having to extract the values.
If I’ve understood it correctly, the % is a wildcard for “some string” (from MySQL LIKE) so looking for a match for %monday% means “match any articles where the value of the matched custom field contains the string ‘monday’ somewhere in it”. So if your custom field values are something like monday|wednesday|friday and saturday|sunday and monday|tuesday|wednesday|thursday|friday, it will output the first and third results.
TXP Builders – finely-crafted code, design and txp
Offline
#103 2022-02-07 09:11:08
Re: glz_custom_fields v2 beta for Textpattern v4.7
jayrope wrote #332661:
The first thing i needed to do is to extract each marked single entry from a multi-select glz_cf custom field.
Unfortunately, I don’t remember how glz_cf stores its values, but if you manage to make it output a string like
monday|wednesday|friday
then splitting it is easy. For pre-4.8.8 txp there is a number of plugins (e.g. adi_list, etc_query, rah_repeat, smd_each) that can do it. In 4.8.8 it should work natively:
<txp:custom_field name="opening_times" breakby="|" breakform="timetable" />
where timetable misc-type form could be
<a href="?opening_times=%<+>%"><+></a>
Offline
#104 2022-10-06 07:40:32
Re: glz_custom_fields v2 beta for Textpattern v4.7
A little fwiw, for those who are annoyed by those PHP8.1 warning(s) on the Write tab in debug mode.
Open up the plugin file, and find function glz_clean_default (line 957-963) and update this way (diff):
- return preg_replace($pattern, "$1", $value);
+ return preg_replace($pattern, "$1", (string)$value);
Save the plugin file, access the Write tab and enjoy the calm.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#105 2024-02-17 19:02:13
Re: glz_custom_fields v2 beta for Textpattern v4.7
Is there a way to extract the pre-entered values of select/multi-select or checkbox/radio button?
For example, say my values for custom_field ‘genre’ were:
Sci-Fi
Romance
Thriller
Pre-Code
is there a way to pull them out and display on a public page?*
For example:
<select>
<option>Sci-Fi</option>
<option>Romance</option>
<option>Thriller</option>
<option>Pre-Code</option>
</select>
I’d like my user to be able to update in the Extentions->Custom Fields and not have to go edit a webpage afterwards.
- Without resorting to some <txp:php> database coding
Offline