[wp-hackers] wp_die vs hooking into admin_notices

Chris Williams chris at clwill.com
Fri Jan 28 18:12:43 UTC 2011

This conversation is near and dear to me, as I'm in the middle of
developing a plug-in that does some extensive and sophisticated
statistical work.  While I'm working hard to eliminate dependencies on
versions of things (PHP, MySQL, etc.), or on certain server add-ons
(BCMATH), I'm not entirely sure (yet) if that's completely possible.

The question then is, what's the appropriate way to fail for the user if
their setup doesn't meet the requirements?  Do you:

- Somehow fail the activation (as this OP was suggesting), and if so
what's the "correct" way to do so.
- Let the plugin be activated, but present some message at each
"admin-init" that warns about the issue.
- Fail the execution of the dependent operation, which may be quite some
time later.

I, like the OP, thought the first was the best choice.  But I'd like to
hear alternatives.

On 1/28/11 9:54 AM, "Peter Westwood" <peter.westwood at ftwr.co.uk> wrote:

>On 28 Jan 2011, at 17:41, Ozh wrote:
>> The best way would be not to rely on curl but use the HTTP API instead.
>> http://codex.wordpress.org/HTTP_API
>And the second thing is not to abuse an activation hook like this.
>If your plugin needs something check in in code run on admin_init and
>display an admin_notice.
>Peter Westwood
>http://blog.ftwr.co.uk | http://westi.wordpress.com
>C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
>wp-hackers mailing list
>wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list