Opened 17 years ago
Closed 17 years ago
#7123 closed enhancement (fixed)
New wp.getOptions and wp.setOptions XML-RPC methods
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5.1 |
Component: | XML-RPC | Keywords: | has-patch |
Focuses: | Cc: |
Description
There are a number of options (and information variables) in WordPress that would helpful to blog clients. Some of these are strictly informational and therefore read-only, while others could be changed. I've added two new XML-RPC methods: wp.getOptions and wp.setOptions, along with a list of options that are to be exposed. To start with the list is fairly small, but it's very easy to add more.
The option list looks like this:
{ 'option_name': { 'desc': 'Label Description Here', 'readonly': true, 'value': 123 } }
The readonly field will be either true or false, the desc field will always be a string. The value field might be a little tricky, some values will be numeric, others will be strings. Check out the patch for the current list of options, it's pretty clear.
The wp.getOptions method looks like:
wp.getOptions( blog_id, username, password, array )
The last parameter, array, is optional. If it is not included then it will return all of the option info that we have. With a populated array, each field is an option name and only those options asked for will be returned.
The wp.setOptions method looks like:
wp.setOptions( blog_id, username, password, struct )
That last struct parameter is option name/value pairs. The return value is same as if you called wp.getOptions asking for the those option names, only they'll include the new value. If you try to set a new value for an option that is read-only, it will silently fail and you'll get the original value back instead of the new value you attempted to set.
This addresses the issue of exposing the time zone info as requested in ticket #5659.
Attachments (1)
Change History (5)
#3
@
17 years ago
- Owner changed from anonymous to westi
- Status changed from new to assigned
Changes made to the patch before committing.
- Made all dynamic options fully dynamic - the are always read and written from the database in the operations so we don't have to keep calling the filter.
- Refactored the read code to be shared.
Updated patch with the ability to filter the blog options array (suggest by westi), make time_zone updatable and doesn't have cruft at the end of it.