Opened 9 years ago
Last modified 8 years ago
#33542 new feature request
User preferences API idea
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | 2nd-opinion |
Focuses: | Cc: |
Description
When setting up a new site, many site Settings seem at first like user preferences even though they aren't. For sites with 1 user blogging out to the world, this makes sense, but for more robust installations a single set of site settings does not satisfy all users.
I'd like to propose a user preferences API be invented. This API would consist of a series of functions that connect usermeta to site & network options, and when invoked, will traverse the user/site/network hierarchy and use the first available setting. Something like:
$language = wp_get_user_preference( $user_id, 'WPLANG' );
Imagine then, that wp_get_user_preference()
would first look in wp_usermeta
, then in wp_options
and then in wp_sitemeta
if multisite. This is obviously a fuzzy example, and there are less obvious caveats (like what to do when usermeta keys do not match option keys, etc...) which can all be conditionally addressed as we poke holes in the idea.
Here are a few settings that could be candidates, taken from their verbiage in various administration screens:
General
- Timezone
- Date format
- Time format
- Start of week
- Language
Writing
- Formatting
- Default Post Category
- Default Post Format
Reading
- Blog pages show at most
- Syndication feeds show the most recent
Discussion
- Default article settings
- Email me whenever
- Avatar Display
Attachments (1)
Change History (6)
#2
@
9 years ago
Note that what starts as a simple suggestion can (and should IMO) turn into thoughts about UI, conveying to users that their preferences are/not in effect, anomalies where maybe a user should never be allowed a preference (I.E. they cannot disable SSL when a site forces SSL, etc...)
Each option & permutation would require scrutinization, testing, and adjustment before going into WordPress core. Until that happens, the API itself could be rolled in early and used for 1 or 2 critical preferences to start.
#3
@
9 years ago
I've created a GitHub repository if anyone would like to collaborate on the code behind this idea further, and will likely release this in the plugins repository as well.
Primitive, fuzzy pseudo-code might start by looking like this: