WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#18467 closed task (blessed) (fixed)

Redirect to About WordPress page after upgrade

Reported by: sparkweb Owned by: nacin
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

When the plugins and themes are upgraded, there's a helpful menu option to "Go To WordPress Updates Page". This is a very useful link as it allows me to get back to the updates page easily. The core upgrade, though, doesn't have such a link (only Go To Dashboard). I often update a site and it's a two (or three) step process, updating core, plugins, and themes. It would be helpful if the updates link appeared on core updates as well.

Proposed Code Change, wp-admin/update-core.php, line 65.

Old Code

show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a> ' );

New Code:

show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a> | <a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>' );

Link copied from wp-admin/includes/class-wp-upgrader.php line 1202

Attachments (9)

18467.patch (734 bytes) - added by SergeyBiryukov 3 years ago.
18467.2.patch (1.5 KB) - added by ocean90 2 years ago.
18467.3.patch (1.9 KB) - added by ocean90 2 years ago.
18467.4.patch (1.6 KB) - added by ocean90 2 years ago.
Don't wait until page is rendered complete, redirect as fast as we can.
18467.diff (5.6 KB) - added by nacin 2 years ago.
18467.2.diff (5.6 KB) - added by nacin 2 years ago.
Fixes bad sprintf().
18467.alt.diff (4.8 KB) - added by nacin 2 years ago.
18467.3.diff (1.9 KB) - added by nacin 2 years ago.
TwoIsOneTooMuch.patch (780 bytes) - added by ocean90 2 years ago.

Download all attachments as: .zip

Change History (52)

SergeyBiryukov3 years ago

comment:1 SergeyBiryukov3 years ago

  • Keywords has-patch added

comment:2 nacin2 years ago

  • Milestone changed from Awaiting Review to 3.3
  • Type changed from enhancement to task (blessed)

I'm hijacking this ticket so we can implement redirection/linking to the new about.php screen.

comment:3 nacin2 years ago

  • Keywords needs-patch added; has-patch removed

comment:4 jane2 years ago

@nacin: Do you actually mean "linking from the new about.php screen"? I'll have @chexee add a back-to-updates link from about.php next to the Dashboard link. She's patching it right now and will post to #18742. One thing though -- prob need a snippet to check for permissions since we're showing about.php to everyone, not just people with update caps, yeah?

comment:5 nacin2 years ago

  • Owner set to ocean90
  • Status changed from new to assigned

No, I mean linking and/or redirecting from the core update to about.php.

comment:6 nacin2 years ago

  • Version changed from 3.2.1 to 3.3

comment:7 ocean902 years ago

18467.2.patch
Because a PHP redirect isn't possible (header already sent output) we need some Javascript magic here. Jane and rboren are fine with this.

  • I added a simple function which hooks into admin_footer-update-core.php
  • On success WP returns a link to dashboard, which can be checked via Javascript
  • If link is there redirect too admin_url( 'about.php?afterupgrade=1' )

ocean902 years ago

comment:8 ocean902 years ago

And we shouldn't forget to add a hook for our next releases.

comment:9 ocean902 years ago

  • Summary changed from Standardize Language on Core Update to Redirect to About WordPress page after upgrade

comment:10 nacin2 years ago

In [19441]:

Hide unrelated maintenance message on update-core when you are running the latest version, and show a link to about.php. see #18467.

comment:11 nacin2 years ago

In [19442]:

Redirect to about.php on update. props ocean90. see #18467.

comment:12 nacin2 years ago

Leaving open to see if there is a hook we can abuse for a link that can work without JS, and other minor tweaks (discussed in IRC).

Cleared for beta 4.

comment:13 DH-Shredder2 years ago

Had a discussion with a tester on IRC that was confused by the behavior, because during a browser lag, they attempted to click the "Go to Dashboard" link after upgrade, and the browser then redirected to about.php (making it look like the link pointed to about.php).

In this case, at least, the PHP redirect would have been helpful.

If we only want users to continue to the Welcome/about page in this case, the link could also potentially be changed to match the behavior that would otherwise happen with the redirect.

comment:14 DH-Shredder2 years ago

  • Cc mike.schroder@… added

comment:15 allstruck2 years ago

  • Cc allstruck added

@nacin:
How about leaving the auto-redirect with JS, and rewriting that link to the dashboard in a more explanatory way.
e.g.:
You should be redirect to LINK automatically.

Agreeing with DH-Shredder, the link should match the redirect. And unless there's going to be a lag between the redirect no other links seem necessary.

Agreeing with OP (sparkweb) as well, it would be nice to have the ability to link elsewhere. I would propose rather than adding links that an option be created to override the location (for both the link and redirect.)

comment:16 sparkweb2 years ago

My two cents is that power users will be annoyed at always being redirected away to an informational screen. I think it would be better to have the list of links - maybe a button inviting new users to find out what's new in 3.3.

comment:17 jane2 years ago

I would rather the redirect. It's pretty common in open source software to get that kind of screen after an update. See Thunderbird, Mozilla, etc. Power user or not, an orientation to what's about to be different is useful.

comment:18 allstruck2 years ago

I have to agree with jane... might there be room for links to "what you might want to do now" on the about page?

What would you think of that sparkweb?

Last edited 2 years ago by allstruck (previous) (diff)

comment:19 sparkweb2 years ago

@allstruck: I'd be okay with that. I just want an easy way to continue with my updates if that's the path I want to take.

comment:20 sparkweb2 years ago

Just installed 3.3 beta 4 and I like the new welcome screen a lot. I think my only request would be to have the "Return to Dashboard" links on the bottom be available at the top of the page as well so scrolling to the bottom wouldn't be required.

comment:21 nacin2 years ago

  • Owner changed from ocean90 to nacin
  • Status changed from assigned to accepted

I've got further tweaks planned for this prior to RC1. The links and redirect will be polished a bit.

Last edited 2 years ago by nacin (previous) (diff)

comment:22 ocean902 years ago

allstruck: Please have in mind, that new strings can't be translated by WordPress < 3.3, without reloading the language files.

wp-admin/includes/update-core.php is the only file, which will be replaced during the upgrade and included again.

comment:23 follow-up: jane2 years ago

@nacin: What tweaks were you thinking of doing?

I don't want to mar the page with links at the top. The regular navigation already provides access to the main Dashboard by way of the ever-present admin menu. Adding another link to Dashboard at top of screen would be restrictive and cluttering. That point also addresses @allweb's suggestion. We don't need a bunch of 'what do you want to do now' links -- they can get anywhere with a single click already using the left nav.

Version 0, edited 2 years ago by jane (next)

comment:24 ocean902 years ago

I think reloading the textdomain could bring us some nice improvments. We can add a info what is happing and maybe show a link for no-js.

	// Load the default text localization domain.
        unload_textdomain( 'default' ) ;
	$locale = get_locale();
	load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );
Last edited 2 years ago by ocean90 (previous) (diff)

ocean902 years ago

comment:25 ocean902 years ago

18467.3.patch is another approach.

  • We can add an action in update_core named _core_updated_successfully
  • Now we can hook into it and do some magic.

ocean902 years ago

Don't wait until page is rendered complete, redirect as fast as we can.

comment:26 in reply to: ↑ 23 nacin2 years ago

Replying to jane:

@nacin: What tweaks were you thinking of doing?

I don't want to mar the page with links at the top. The regular navigation already provides access to the main Dashboard by way of the ever-present admin menu. Adding another link to Dashboard at top of screen would be repetitive and cluttering. That point also addresses @allweb's suggestion. We don't need a bunch of 'what do you want to do now' links -- they can get anywhere with a single click already using the left nav.

@Jane, only referring to links like 'Go to Dashboard' on the core update itself. Nothing more on the About page.

comment:27 nacin2 years ago

  • Keywords has-patch added; needs-patch removed

I didn't see ocean90's comments or patches until now. Nice work. :)

I will test this out, but it's very close to what I was going to try to do. Probably better.

comment:28 follow-up: duck_2 years ago

If we hook into update_core() we could remove the version_compare() on $GLOBALS['wp_version']. Currently we will have to update the comparison number every version.

comment:29 in reply to: ↑ 28 nacin2 years ago

Replying to duck_:

If we hook into update_core() we could remove the version_compare() on $GLOBALS['wp_version']. Currently we will have to update the comparison number every version.

I think ocean90's idea was that this would be for 3.3 only and we would make it less hacky now, to apply for 3.3+.

comment:30 ocean902 years ago

Nacin is right. We should place the same (more or less) in do_core_upgrade().

comment:31 ocean902 years ago

One point for about.php "Return to Dashboard → Updates" isn't the right string for multisite, IMO.

nacin2 years ago

comment:32 nacin2 years ago

18467.diff:

  • Debug Code — Includes debugging code. Specifically, the window.location bits are commented out and files are not copied. This means your install will not be overridden with the nightly, and your in situ wp-admin/includes/update-core.php will be used.
  • Includes no-JS support – namely, a separate string. The no-JS string looks like this:

Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.

  • The with-JS string looks like this:

Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.

  • As discussed with ocean90 and duck_, I made it so _redirect_to_about_wordpress() only fires when the current install is < 3.3. Once the install is 3.3, the new strings will be in the POT file, and the new code will be in place in wp-admin/update-core.php.
  • I needed to alter the return of wp_update_core() to include the *new* version number, otherwise I couldn't do the previous bullet point. This makes me second-guess the previous bullet point as unnecessary.
  • In multisite, about.php?updated now links back to the network/update-core.php file.

Thoughts?

nacin2 years ago

Fixes bad sprintf().

nacin2 years ago

comment:33 nacin2 years ago

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

In [19524]:

Finalize the code which redirects to about.php after a core update. Only triggers on update-core.php in case wp_update_core() is called in a different context.
props ocean90 for initial patch. fixes #18467.

comment:34 nacin2 years ago

In [19527]:

Use GLOBALS. see #18467.

comment:35 nacin2 years ago

In [19529]:

Push logic into _redirect_to_about_wordpress() and be more specific about which context this runs under. see #18467.

comment:36 nacin2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Variable collision and leftover debug.

nacin2 years ago

comment:37 ryan2 years ago

Looks good.

comment:38 nacin2 years ago

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

In [19532]:

Remove debug cruft and fix variable collision. fixes #18467.

ocean902 years ago

comment:39 ocean902 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:40 ryan2 years ago

Looks good.

comment:41 nacin2 years ago

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

In [19535]:

Remove duplicated line. props ocean90, fixes #18467.

comment:42 toscho2 years ago

  • Cc info@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

After some tests I strongly suggest not to redirect if there are still plugins waiting for an update. In this case there is no time to read the about page anyway, and the extra click back to the update page is just wasting time.

comment:43 nacin2 years ago

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

You may open a new ticket, but I assume it will be closed quickly. For a user, the about page is not a waste of time. Plugins can wait 5-10 minutes.

Note: See TracTickets for help on using tickets.