Opened 9 years ago
Last modified 6 years ago
#35450 new defect (bug)
Relocate user's primary_blog setting to user profile
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Users | Keywords: | |
Focuses: | multisite | Cc: |
Description (last modified by )
In multisite installations, the primary_blog
user setting is an anomaly:
- It's located in
my-sites.php
vs.user-edit.php
orprofile.php
. - It's both presented and conditionally saved in
choose_primary_blog()
vs. inwp_insert_user()
along with the rest of a user's data & meta - It uses the
_user_option()
functions with the$global
flag set to true, instead of_user_meta()
functions. At a glance, the code makes this look likeprimary_blog
might be a per-site setting, which wouldn't make any sense.
I'd like to suggest we do a few things to improve this setting:
- Move this setting into the user profile, and remove it from
my-sites.php
- Move the saving of the
primary_blog
user meta key intowp_insert_user()
so it can added to a user a object - Introduce a new function, similar to
choose_primary_blog()
, for displaying this field in the user profile - Switch to using the
user_meta()
functions, away fromuser_option()
Attachments (2)
Change History (5)
#2
in reply to:
↑ description
@
9 years ago
- Keywords 2nd-opinion removed
Replying to johnjamesjacoby:
In multisite installations, the
primary_blog
user setting is an anomaly:
Period. :)
I'd like to suggest we do a few things to improve this setting:
- Move this setting into the user profile, and remove it from
my-sites.php
- Introduce a new function, similar to
choose_primary_blog()
, for displaying this field in the user profile
I'm conflicted on removing it from my-sites.php
.
I don't like where it is right now, though I'm not sure if moving it to the user profile makes that experience better for the user. In either location, it's currently a case where introducing something like Select2 (#31696) makes sense.
If it does belong in my-sites.php
, then it should be better integrated with the UI sites so that there are not 2 lists of sites for a user to wade through. A "make this my active site" indicator or something.
- Move the saving of the
primary_blog
user meta key intowp_insert_user()
so it can added to a user a object- Switch to using the
user_meta()
functions, away fromuser_option()
At first glance, these make sense. I could also see some other clarifications/corrections coming up when exploring how active_blog
is used.
#3
@
8 years ago
My initial thought would be that the setting should remain in the "My Sites" screen. While it's stored as user meta, it belongs to that "My Sites" screen since this gives the setting more context than if it was in the user profile. However the improvement @jeremyfelt proposed (instead of a dropdown, add "Make this my primary site" as a row action to each site item listed) makes sense.
Regarding switching from *_user_option()
to *_user_meta()
, I'm not sure about that. I think there is a semantic difference between the two although we store both as meta internally. As meta I would understand further user data while as option I would understand user preferences (mainly for the admin), plus it takes care of prefixing the key with the current site ID. Actually I think the choose_primary_blog()
does it semantically wrong as it should rather call update_user_option()
instead of update_user_meta()
.
My approach would be rather than mixing "user data" and "user settings" together, we should clearly separate the two anywhere it's currently fuzzy (like in choose_primary_blog()
).
Current Location