[wp-trac] [WordPress Trac] #60992: Plugin management: AJAX plugin activation consequences
WordPress Trac
noreply at wordpress.org
Wed Apr 17 08:39:55 UTC 2024
#60992: Plugin management: AJAX plugin activation consequences
-------------------------------------------------+-------------------------
Reporter: jeherve | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.5.3
Component: Plugins | Version: 6.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing has- | Focuses:
testing-info |
-------------------------------------------------+-------------------------
Comment (by costdev):
@roytanck In terms of whether it's possible, definitely. We already have
the `wp.updates.addAdminNotice()` method in JS, so something like this
would be pretty straightforward to implement:
- In the PHP AJAX callback: `apply_filters( 'wp_plugin_activated_message',
'', $status['plugin'] )` and add a non-empty message to the response
(sanitized/escaped as needed)
- In `wp.updates.activatePluginSuccess()`: If not inside a modal and a
message is present, output the message via `wp.updates.addAdminNotice( {
className: 'notice notice-success', message: response.message } )`
Though as you said, if that approach was used, it would be something for
after this ticket, in a future major release as the hook would be an
enhancement and would also require uptake by plugin authors.
In theory, a default message and action could be used for 6.5.3, like:
`[plugin] activated successfully. <a>Manage plugins/Reload the
page/something</a>`. This would add the missing messaging whose absence is
currently breaking the flow.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60992#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list