Make WordPress Core

Opened 8 years ago

Last modified 11 months ago

#34986 new enhancement

Add Upgrade Notice for Themes

Reported by: afragen's profile afragen Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-patch needs-testing has-testing-info has-screenshots
Focuses: Cc:

Description

There is upgrade notice for plugins that displays on the core update page if $transient->upgrade_notice is set in the pre_set_site_transient_update_{plugins|themes} filter, but there is no corresponding upgrade notice used or available for themes.

I propose adding a similar usage for themes as currently exists for plugins.

Use case, when theme upgrades are pending a notice of what changes, etc. will be available from the main update page.

Attachments (3)

34986.diff (1.4 KB) - added by afragen 8 years ago.
34986-test.png (26.6 KB) - added by oglekler 11 months ago.
test-34986.zip (591 bytes) - added by zunaid321 11 months ago.

Download all attachments as: .zip

Change History (25)

@afragen
8 years ago

#1 @afragen
8 years ago

  • Keywords has-patch added

#2 @johnbillion
8 years ago

  • Version trunk deleted

#3 @afragen
8 years ago

Any comments?

This ticket was mentioned in Slack in #core-upgrade-install by costdev. View the logs.


15 months ago

#5 @costdev
15 months ago

  • Milestone set to 6.3

#6 @costdev
15 months ago

  • Keywords needs-testing needs-testing-info added

@afragen Can you drop some testing info so that the patch can be tested? Thanks!

Additional props: @pbiron

#7 @afragen
15 months ago

  • Keywords needs-refresh added

This ticket was mentioned in PR #4238 on WordPress/wordpress-develop by @afragen.


15 months ago
#8

  • Keywords needs-refresh removed

Updated PR for adding an upgrade notice to theme updates in update-core.php as there is for plugin updates.

Trac ticket: https://core.trac.wordpress.org/ticket/34986

#9 @afragen
15 months ago

You can test the PR with the following plugin code. Obviously this would need to be added by the theme dev.

<?php
/**
 * Plugin Name: Test #34986
 * Description: Testing Trac Ticket #34986
 * Author: WP Core Contributors
 * Version: 0.1
 */

add_filter( 'site_transient_update_themes', 'add_upgrade_notice_34986', 20, 1 );

function add_upgrade_notice_34986($transient){
    $theme_slug = 'twentytwentythree';
    if ( isset($transient->response[$theme_slug])){
        $transient->response[$theme_slug]['upgrade_notice'] = 'Test of upgrade notice, #34986.';
    }

    return $transient;
}

To test, decrease the local version number of the Twenty Twenty Three theme so that it shows an update.

#10 @afragen
15 months ago

Above is for testing. I'm pretty sure all the dev needs to do is add a section == Upgrade Notice == to their readme.txt for the specific update and the readme parser in dot org will add the data to the update transient.

#11 @afragen
15 months ago

  • Keywords needs-testing-info removed

This ticket was mentioned in Slack in #core-upgrade-install by pbiron. View the logs.


13 months ago

@oglekler
11 months ago

#13 @oglekler
11 months ago

  • Keywords has-testing-info has-screenshots added

Patch (#comment:8) works as expected, screenshot is above.

We are in 9 days until the Beta 1, so, if this is going to trunk, it needs to move.

#14 @afragen
11 months ago

Corresponding ticket for plugins, #57939

#15 @zunaid321
11 months ago

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/4238.diff

Environment

  • OS: Windows 11 (22H2)
  • Web Server: nginx/1.23.4
  • PHP: 7.4.33
  • WordPress: 6.3-alpha-55505-src
  • Browser: Chrome Version 114.0.5735.110 (Official Build) (64-bit)
  • Theme: Twenty Twenty-Three

Testing Instructions

  • Applied Patch
  • Activated Attached Plugin - test-34986.zip
  • Lowered the theme version of Twenty Twenty Three Theme
  • ✅ The update notice showed up in the Updates Page for the Themes section.

Plugins Used

  • Attached: test-34986.zip

Screenshots

#16 @peterwilsoncc
11 months ago

  • Milestone changed from 6.3 to Future Release

I asked the meta folks in Slack if the themes upgrade API endpoint included an upgrade notice and was told it doesn't.

Apparently the API only includes data in the stylesheet headers.

I think there has been discussion in the past about introducing one but it's premature to include the feature in core until it exists. I'm going to bump this to a future release so any action can be coordinated with the meta team.

#17 @afragen
11 months ago

@peterwilsoncc you're looking in the wrong place. Neither plugins or themes has this data from the API. The data exists as parsed data from the readme.txt file from the parser where it is included in the update data if it exists.

This ticket was mentioned in Slack in #meta by afragen. View the logs.


11 months ago

#19 @dd32
11 months ago

This would be pending https://meta.trac.wordpress.org/ticket/215 as readme.txt is not parsed for themes at all on WordPress.org. There's unlikely to be any movement on that (IMHO) until the Theme Directory is redesigned to accomodate it.

you're looking in the wrong place. Neither plugins or themes has this data from the API.

Plugins do offer this data via the API.

#20 follow-up: @afragen
11 months ago

Dion why are these or any of the APIs private. It makes things like this very difficult.

#21 @peterwilsoncc
11 months ago

The transient filter for testing in comment 9 shows the displayed data is intended to come from the API. If the theme update API adds support for upgrade notices then I'll happily add this feature to core, otherwise the code will go unused.

#22 in reply to: ↑ 20 @dd32
11 months ago

Replying to afragen:

Dion why are these or any of the APIs private. It makes things like this very difficult.

While it's not ideal it's private (There's no reason AFAIK, other than the breakage that would happen during migrating of it), there's nothing in there that's related to this ticket.

The fields are not parsed/stored/touched by the Theme Directory code-base, which is open-source. In the event it's added there, it's literally a 1 line addition to the update-check API to fetch that meta_value field too.

Note: See TracTickets for help on using tickets.