WordPress API 4

Posted by Jason on July 05, 2009

Recently I’ve gotten into WordPress plugin development. I’ve created a few plugins for clients that include widgets, settings pages, and hooks into several actions. However, one thing I’ve not yet been able to figure out is how to encrypt settings page options. Has anyone done this?

There are currently a few ways to create settings pages. You can either write out the entire form, or you can create sections and fields using the API. Each option, however, utilizes get_option() to show the current value.

This is fine, however there is no API function (that I’ve found) that runs BEFORE an option is updated. The only function I have right now is update_option_(the_option)(). But, this runs AFTER the update has already happened. So, if I wanted to encrypt those options using server-side encryption, I would enter into an infinite loop since I’d be calling update_option_(the_option)() over and over again.

Has anyone ever encrypted settings page option values before? If so, how do you go about doing it properly?

I’m sure I can hack together a solution that encrypts & decrypts the values using Javascript on the form, but that just seems dirty to me.

I’d be interested to hear if anyone else has had this problem.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Austin Sun, 09 Aug 2009 13:13:13 UTC

    I’m looking for some help using the wordpress API. I need to create a page that will let a customer fill out a form and from that info create a wordpress page.

    I am using custom fields now, and that works, but I have to do the work. I need a way to have a customer input their own information (custom fields will work here as well), and maybe even edit it later.

    So I guess it would have to be tied to their userid / password. We could create the page for them, and the let them edit the custom fields or something like that.

    Interested in helping?

    Austin

  2. Christian Wed, 02 Sep 2009 19:20:23 UTC

    Hi Jason,

    I saw your Bronto Ruby API post on DZone, but the download is now broken. Do you still have it available? It would totally save me a good amount of time if you did.

    Thanx!

  3. Jason Wed, 02 Sep 2009 20:13:22 UTC

    Hi Christian,

    Yes, that post was a long time ago! I’m sure the Bronto API has changed since I last worked with it, but if they are still rockin’ the wsdl with the authenticated session header then I’m sure it’s still a bear to get connected with Ruby.

    Anywho, I’ve gzipped up the old bronto Ruby code.

    http://www.jason-palmer.com/bronto.tar.gz

    Enjoy!

  4. Christian Fri, 04 Sep 2009 12:57:45 UTC

    Thanx dude!!! You rock. I’m going to give it a look. If I make any changes, I’ll send them back to you. They don’t seem to have that many updates so I’m hoping it won’t be a full rewrite.

Comments


Clicky Web Analytics