Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-26 13:35:51

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Checking for name of custom_field upon creating them

Once again had some hours of debugging – named on custom_2 as “sort”. After this article_custom was searching in custom_2 everything, i entered in sort="Title" attr :)

<txp:article_custom limit="999" break="li" wraptag="ul" sort="Posted asc" section='<txp:section />'>

..was givven this:

[SQL (0,000347852706909): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('video') and custom_2 like 'Posted asc'  order by Posted asc limit 0, 999]

Figured out the bug only after started new “bug thread” in this forum and typed “…custom_field was named “sort”…

So, the idea is to check cf names and throwing errors in the top. It would be very handy for newbies (and for older too :) i think.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#2 2011-01-26 13:50:19

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Checking for name of custom_field upon creating them

Yes, I went through the same thing some years ago. Makes sense to have Txp check for reserved names when an admin renames a custom field.

Last edited by jsoo (2011-01-26 13:50:49)


Code is topiary

Offline

#3 2011-01-26 13:52:05

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

Re: Checking for name of custom_field upon creating them

jsoo wrote:

Makes sense to have Txp check for reserved names

Or namespace custom fields…?


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

#4 2011-01-26 14:10:35

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Checking for name of custom_field upon creating them

Even better.


Code is topiary

Offline

Board footer

Powered by FluxBB