[wp-trac] [WordPress Trac] #9899: edit_post_link() performs
redundant permissions checking
WordPress Trac
wp-trac at lists.automattic.com
Thu May 21 18:50:25 GMT 2009
#9899: edit_post_link() performs redundant permissions checking
-------------------------+--------------------------------------------------
Reporter: coffee2code | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.8
Severity: normal | Keywords: has-patch tested
-------------------------+--------------------------------------------------
`edit_post_link()` duplicates permission checks that are already (and
always) performed in `get_edit_post_link()`.
`edit_post_link()` has checks to ensure `current_user_can('edit_post',
$post->ID)` (and similar if it's a page). If the user can, then
`get_edit_post_link()` is called, which repeats those checks.
The attached patch has `edit_post_link()` defer to `get_edit_post_link()`
for the check. This eliminates code duplication and redundant processing,
centralizes this permission checking, and removes lines of code; wins all
around.
Patch is also compatible with changes I suggested in #9898.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9899>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list