WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#32645 closed defect (bug) (fixed)

Save Changes button should not show on my-sites.php when user is only member of one site

Reported by: jmacaluso711 Owned by: jeremyfelt
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: has-patch
Focuses: ui, administration, multisite Cc:

Description

In my sites there is a select box to change your primary site even if you only have one site. It doesn't make any sense to have the select if you only have one site.

Attachments (5)

primary-site-save-changes-button.png (118.3 KB) - added by earnjam 3 years ago.
Screenshot
32645.patch (535 bytes) - added by Oxymoron 3 years ago.
Removes Save Changes button when there is only 1 site
32645.diff (559 bytes) - added by obenland 3 years ago.
Shows button if user has one site and no extra settings are added.
32645.2.diff (686 bytes) - added by jeremyfelt 3 years ago.
after-32645.2.diff.png (61.2 KB) - added by jeremyfelt 3 years ago.

Download all attachments as: .zip

Change History (14)

#1 @earnjam
3 years ago

  • Component changed from General to Networks and Sites
  • Focuses ui added
  • Keywords needs-patch ux-feedback added
  • Summary changed from Primary site select box should not show when user is only member of one site to Save Changes button should not show on my-sites.php when user is only member of one site
  • Version changed from trunk to 3.0

The main issue seems to be the appearance of the "Save Changes" button when there are no changes that can even be made. The select box just renders as text.

Perhaps we should conditionally show the button (or the entire form) only when you are a member of more than one site.

#2 @jeremyfelt
3 years ago

  • Milestone changed from Awaiting Review to 4.3

Good call @jmacaluso711, thanks for the ticket!

@Oxymoron
3 years ago

Removes Save Changes button when there is only 1 site

#3 @Oxymoron
3 years ago

  • Keywords has-patch added; needs-patch removed

Attached a patch that removes the 'Save Changes' button when the user only has 1 site (meaning they have nothing to update or save).

#4 @earnjam
3 years ago

Only problem I see here is that there is a filter on this page for adding additional input fields for the whole form or each site on the list, which is also why the save changes button appears at the bottom instead of the top.

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


3 years ago

@obenland
3 years ago

Shows button if user has one site and no extra settings are added.

#6 @obenland
3 years ago

  • Keywords ux-feedback removed

@jeremyfelt: Your turn. :)

#7 @jeremyfelt
3 years ago

  • Owner set to jeremyfelt
  • Status changed from new to reviewing

@jeremyfelt
3 years ago

#8 @jeremyfelt
3 years ago

32645.2.diff also places the nonce and action inputs in the conditional output.

We don't use has_filter much in core, but the use case here makes sense.

#9 @jeremyfelt
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 33080:

Only output Save Changes in My Sites when a user is a member of more than one site.

The conditional also checks for the existence of filters that may otherwise alter the HTML in My Sites to include extra form inputs for these users. If a filter is in use, the Save Changes button will display.

Props @Oxymoron, @obenland.
Fixes #32645.

Note: See TracTickets for help on using tickets.