[wp-trac] [WordPress Trac] #14044: check_admin_referer is a template tag only

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 22 12:08:58 UTC 2010


#14044: check_admin_referer is a template tag only
-------------------------+--------------------------------------------------
 Reporter:  hakre        |       Owner:                          
     Type:  enhancement  |      Status:  new                     
 Priority:  normal       |   Milestone:  Unassigned              
Component:  General      |     Version:  3.0                     
 Severity:  normal       |    Keywords:  needs-patch dev-feedback
-------------------------+--------------------------------------------------
 when a plugin author wants to check (e.g. in the init hook) if a certain
 admin_referer is available or not, the plugin needs to write it's own
 admin referer implementation because the existing function

 {{{check_admin_referer()}}}

 can only be used to check for, but not agains (if it's not the appropriate
 refer, the script will die.

 this is mainly because that function is to be used as a admin "template
 tag" only.

 useful would be a function that will return a boolean value instead of
 dieing / continuing execution.

 this can be done by moving the decision out of {{{check_admin_referer()}}}
 into a new function {{{check_admin_referer_test()}}} and leave the die in
 there.

 this will make plugin coding more safe because right now no such function
 exists and that done it's hard to check pre-conditions like proper form
 submits in init.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14044>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list