WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#9991 closed enhancement (wontfix)

Wrap plugin notices in a function

Reported by: scribu Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords:
Focuses: Cc:

Description

Currently, all plugin notices are simply echoed in the plugins.php page, which means that there is no clean way to remove or replace these notices.

The proposed patch simply wraps all that code in a function and hooks it to the 'admin_notices' action.

Attachments (2)

plugins.patch (4.7 KB) - added by scribu 12 years ago.
Put all plugin notices in the function plugin_notices()
plugins.diff (1.1 KB) - added by scribu 12 years ago.
refresh

Download all attachments as: .zip

Change History (15)

#1 @scribu
12 years ago

  • Milestone changed from Unassigned to 2.8
  • Owner set to scribu
  • Status changed from new to assigned
  • Version set to 2.7

@scribu
12 years ago

Put all plugin notices in the function plugin_notices()

#2 @Denis-de-Bernardy
12 years ago

  • Keywords early added
  • Milestone changed from 2.8 to 2.9

can wait until 2.9

#3 @Denis-de-Bernardy
12 years ago

patch still applies clean

#4 @scribu
12 years ago

  • Keywords tested commit added; early removed

#5 follow-up: @westi
12 years ago

  • Keywords reporter-feedback added; commit removed
  • Owner changed from scribu to westi
  • Status changed from assigned to reviewing

Can you explain in more detail what you are trying to achieve with this.

I am not sure I see the point in making this change.

#6 @Denis-de-Bernardy
12 years ago

I think he wants to replace the notice management.

#7 in reply to: ↑ 5 @scribu
12 years ago

  • Cc scribu@… added
  • Keywords dev-feedback added; reporter-feedback removed

Replying to westi:

Can you explain in more detail what you are trying to achieve with this.

I am not sure I see the point in making this change.

The usage I have in mind:

On activation, X plugin does a compatibility check.

It doesn't like something and it deactivates itself.

Then, it adds an action to admin_notices:

add_action('admin_notices', 'x_plugin_error', 9);

function x_plugin_error() {
  remove_action('admin_notices', 'plugin_notices');

  echo "<div class='error'><p>This plugin is not compatible</p></div>";
}

Without this patch, there would be two messages: one that says "Plugin not compatible" and one that says "Plugin activated".

#8 @ryan
12 years ago

  • Milestone changed from 2.9 to Future Release

#9 @nacin
12 years ago

  • Keywords needs-refresh added; has-patch tested dev-feedback removed

It's not a bad idea, but the patch is stale.

@scribu
12 years ago

refresh

#10 @scribu
12 years ago

  • Keywords has-patch added; needs-refresh removed

refreshed

#11 follow-up: @westi
10 years ago

  • Keywords reporter-feedback added; has-patch removed

This patch no longer applies.

The proposed usage of the wrapping of the notices in a function wouldn't interact well with bulk activation of plugins where you would still want both messages.

I wonder if the requirement here is no longer valid - I assume the requirement was a better user experience when a user activated a PHP5 plugin on a PHP4 install?

If so I think we should close this as WONTFIX now that isn't an issue.

#12 in reply to: ↑ 11 @scribu
10 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed

Replying to westi:

I wonder if the requirement here is no longer valid - I assume the requirement was a better user experience when a user activated a PHP5 plugin on a PHP4 install?

No, a PHP4 compatibility check was only one potential usage out of many.

The proposed usage of the wrapping of the notices in a function wouldn't interact well with bulk activation of plugins where you would still want both messages.

Agreed.

#13 @scribu
10 years ago

  • Keywords reporter-feedback removed
Note: See TracTickets for help on using tickets.