Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-02 15:46:05

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

prefs_id field in Txp database

Does it serve any purpose? It’s part of the txp_prefs table’s UNIQUE KEY, but it seems to always be set to “1”. Just wondering if I can ignore it and let it default to “0”.


Code is topiary

Offline

#2 2009-09-02 16:40:59

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: prefs_id field in Txp database

Use common sense. If it’s set to 1 everywhere, don’t set it to 0 yourself ;)

Offline

#3 2009-09-02 16:48:19

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

Re: prefs_id field in Txp database

fwiw, I have no idea what it’s for. I do know that I consistently used to assume it was some kind of auto-increment ID and forgot to inlcude it in my SQL statements only to be told off! I never learned, for some reason…

Lucikly, set_pref() and get_pref() save the day now: I use those functions almost exclusively as it does all the drudgery for me, as well as allowing per-user prefs to be created/read in a uniform manner.

Last edited by Bloke (2009-09-02 16:48:56)


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 2009-09-02 17:27:55

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

Re: prefs_id field in Txp database

ruud wrote:

Use common sense. If it’s set to 1 everywhere, don’t set it to 0 yourself ;)

Common sense? Is that a Txp function?

Bloke wrote:

set_pref() and get_pref() save the day now: I use those functions almost exclusively as it does all the drudgery for me, as well as allowing per-user prefs to be created/read in a uniform manner.

Ta!


Code is topiary

Offline

#5 2011-01-09 20:48:47

Themroc
Plugin Author
From: Germany
Registered: 2011-01-02
Posts: 23

Re: prefs_id field in Txp database

After a 10-minute-investigation, i’d say:

If u want prefs_list(), advanced_prefs() and get_prefs() to not see your data, set prefs_id to anything but 1.

Thus, it seems pretty useless…


History teaches us that history teaches us nothing. — Voltaire

Offline

#6 2011-01-14 15:15:58

Themroc
Plugin Author
From: Germany
Registered: 2011-01-02
Posts: 23

Re: prefs_id field in Txp database

Sry, that last sentence was totally wrong. Setting prefs_id != 1 seems to be the only way to not pollute the global namespace with all the stuff from txp_prefs.


History teaches us that history teaches us nothing. — Voltaire

Offline

Board footer

Powered by FluxBB