Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2016-05-10 09:09:03

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: set_pref() to change prefs values on saving

etc wrote #299048:

Nicolas, what if you unset($_POST['something']) in your plugin registered with $pre = 1?

We got a WINNER!


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#14 2016-05-10 11:59:04

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

Re: set_pref() to change prefs values on saving

NicolasGraph wrote #299047:

the pref input value is not refreshed (as it comes from the global scope if I follow you) …and I don’t use get_pref to display this input or its value; the field already exists as it can be also filled manually.

Right, OK, I misunderstood, sorry. In that case, Oleg’s approach is best as it prevents overwriting the input field with the incoming (stale) POST data.


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

#15 2016-05-10 12:11:23

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: set_pref() to change prefs values on saving

Bloke wrote #299051:

Right, OK, I misunderstood, sorry.

No worry i’m not always easy to understand!
Your explanations helped me to have a better understanding of how things work.
Thanks.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#16 2016-05-12 16:11:28

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: set_pref() to change prefs values on saving

Probably not the most useful plugin but if you just want to see how preferences work thanks to you, it’s here.

Last edited by NicolasGraph (2016-05-13 09:40:00)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

Board footer

Powered by FluxBB