load-(page) action hook

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

load-(page) action hook

Eric Marden-2
I ran across this in the codex (http://codex.wordpress.org/Plugin_API/Action_Reference 
), and would like to use it for a plugin I am developing. If I  
understand it correctly, I can specify the name of the page on which  
to fire my plugin functions, but can't seem to figured out the syntax.

The page I want it to fire on is the users page in the admin screen. I  
tried load-(users) and load-users and neither one fired my plugin. I'm  
using admin_head now for the hook, but this makes it fire on every  
admin page, and is inefficient for my needs.

Any one know how to use the load-(page) action hook?

-e
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: load-(page) action hook

Austin Matzko
On Sat, May 24, 2008 at 4:10 PM, Eric Marden <[hidden email]> wrote:
> The page I want it to fire on is the users page in the admin screen. I tried
> load-(users) and load-users and neither one fired my plugin.

The action hook for the users.php page is "load-users.php".

> Any one know how to use the load-(page) action hook?

In general, if you're adding your own admin page, you can figure out
the load action hook from the return value of the function adding the
menu.

For example, the following would call my_load_function() on the
loading of the manage admin page I created:

$my_page = add_management_page(...);
add_action("load-$my_page", 'my_load_function');
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: load-(page) action hook

Viper007Bond-3
In reply to this post by Eric Marden-2
When in doubt, check the source. :)

The hook is called in /wp-admin/admin.php and for non-plugin pages, the hook
name is "load-filename.php". So for you, it'd be "load-users.php".

On Sat, May 24, 2008 at 1:10 PM, Eric Marden <[hidden email]> wrote:

> I ran across this in the codex (
> http://codex.wordpress.org/Plugin_API/Action_Reference), and would like to
> use it for a plugin I am developing. If I understand it correctly, I can
> specify the name of the page on which to fire my plugin functions, but can't
> seem to figured out the syntax.
>
> The page I want it to fire on is the users page in the admin screen. I
> tried load-(users) and load-users and neither one fired my plugin. I'm using
> admin_head now for the hook, but this makes it fire on every admin page, and
> is inefficient for my needs.
>
> Any one know how to use the load-(page) action hook?
>
> -e
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



--
Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: load-(page) action hook

Andrew Ozz
In reply to this post by Eric Marden-2
Eric Marden wrote:

> I ran across this in the codex
> (http://codex.wordpress.org/Plugin_API/Action_Reference), and would like
> to use it for a plugin I am developing. If I understand it correctly, I
> can specify the name of the page on which to fire my plugin functions,
> but can't seem to figured out the syntax.
>
> The page I want it to fire on is the users page in the admin screen. I
> tried load-(users) and load-users and neither one fired my plugin. I'm
> using admin_head now for the hook, but this makes it fire on every admin
> page, and is inefficient for my needs.
>
> Any one know how to use the load-(page) action hook?

The syntax is the same as in admin_print_scripts-(page_hook) or
admin_print_scripts-(plugin_page). The (page_hook) is returned when you
call add_management_page(), or you can hard-code it.
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: load-(page) action hook

Eric Marden-2
In reply to this post by Viper007Bond-3

> When in doubt, check the source. :)

Sorry, I'm bad about that. I can only offer up the poor excuse that at  
least this conversation is indexed for others to possibly stumble upon.


Thanks all for your help though, despite my laziness.

-e

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

URLs in email [was: load-(page) action hook]

Stephen Rider
In reply to this post by Eric Marden-2
On May 24, 2008, at 3:10 PM, Eric Marden wrote:

> I ran across this in the codex (http://codex.wordpress.org/Plugin_API/Action_Reference 
> ), and would like to...


On general principle, it is a good idea when putting URLs into an  
email to wrap them in brackets, like so: <http://codex.wordpress.org/Plugin_API/Action_Reference 
 >.

If you do this, you will prevent dead links resulting from email  
programs getting confused as to what is part of the URL and what is  
not.  (In this instance, the close parentheses was being read as part  
of the link in OS X "Mail".)  I have yet to come across an email  
program that does _not_ properly read angle brackets as delimiters on  
URLs.

A small change to make everyone's life easier.  Sorry for the off-
topic -- just addressing a common irritation.

Stephen

--
Stephen Rider
<http://striderweb.com/>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: URLs in email [was: load-(page) action hook]

Jorge Peña-3
Alright, I've always delimited my URLs, just didn't know what to use. I
always have used []'s [ http://www.google.com ], but the angle brackets
don't look bad.

On Tue, May 27, 2008 at 12:25 PM, Stephen Rider <[hidden email]>
wrote:

> On May 24, 2008, at 3:10 PM, Eric Marden wrote:
>
>  I ran across this in the codex (
>> http://codex.wordpress.org/Plugin_API/Action_Reference), and would like
>> to...
>>
>
>
> On general principle, it is a good idea when putting URLs into an email to
> wrap them in brackets, like so: <
> http://codex.wordpress.org/Plugin_API/Action_Reference>.
>
> If you do this, you will prevent dead links resulting from email programs
> getting confused as to what is part of the URL and what is not.  (In this
> instance, the close parentheses was being read as part of the link in OS X
> "Mail".)  I have yet to come across an email program that does _not_
> properly read angle brackets as delimiters on URLs.
>
> A small change to make everyone's life easier.  Sorry for the off-topic --
> just addressing a common irritation.
>
> Stephen
>
> --
> Stephen Rider
> <http://striderweb.com/>
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers