[wp-hackers] Admin notices

John 3:16 Media wp at john316media.com
Mon Apr 11 07:39:56 UTC 2011


I could always do like Barry said, and just add the message to a globalized
array and hook in once with a single function to itterate though the array
and echo out.
On Sun, Apr 10, 2011 at 11:41 PM, John 3:16 Media <wp at john316media.com>wrote:

> Oops I did not know that, see my last post, that's actually what I use.
> Which means I'll have to redo how I do admin notices, back to the drawing
> board as to how to do this simply without 4 lines of code and a new function
> with lots of redundant code, which idk if that will be possible short of
> some core implementation.
>
>
> On Sun, Apr 10, 2011 at 11:35 PM, Andrew Nacin <wp at andrewnacin.com> wrote:
>
>> On Mon, Apr 11, 2011 at 2:26 AM, Ryan McCue <lists at rotorised.com> wrote:
>>
>> > Rob Miller wrote:
>> > > No need to target 5.3+; you can do anonymous functions in PHP 4.0+:
>> > >
>> > > add_action('admin_notices', create_function('', 'echo "your
>> message";'));
>> >
>> > True, and good point! They just don't look as nice. ;)
>>
>>
>> I would strongly recommend you avoid create_function() at all costs. It
>> poses a pretty serious security risk when used improperly. It's a priority
>> for us to remove all of them from the core codebase. (We're close.)
>>
>> I would also recommend (in general) you avoid closures. I use them in
>> testing all the time -- add_action( 'init', function() { ... } ); -- but
>> in
>> a public plugin, it's not playing very nice with others, as the callback
>> can't easily be removed.
>>
>> Nacin
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
>
> I'm working on a support ticket plugin and I'm looking for users to test
> and provide feedback on it.  Will bribe anyone who helps with a generous
> discount on the final product.  Email me off-list if interested.
>
>
>
>
>


-- 

I'm working on a support ticket plugin and I'm looking for users to test and
provide feedback on it.  Will bribe anyone who helps with a generous
discount on the final product.  Email me off-list if interested.


More information about the wp-hackers mailing list