[wp-trac] [WordPress Trac] #18316: admin comments.php does not allow for non javascript custom actions in comment row action links

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 2 12:32:40 UTC 2011


#18316: admin comments.php does not allow for non javascript custom actions in
comment row action links
--------------------------+-----------------------------
 Reporter:  commentluv    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 If I add a custom link to the comment_row_actions filter it works just
 fine as long as I have javascript enabled and 'catch' the event of a click
 on it and make sure that the href goes nowhere.

 if the user has disabled javascript then the link will not work even if I
 format the href of the link in the same format as the trash link
 eg.
 {{{
 $actions['Remove-luv'] = '<a class="removeluv"
 href="'.admin_url('comment.php').'?c='.$cid.'&action=removeluv&_wpnonce='.$nonce.'">Remove
 Luv</a>';
 }}}

 it cannot be processed because wp-admin/comment.php has the default in the
 switch($action) block set to `wp_die( __('Unknown action.') );`

 There should be code similar to how admin-ajax.php handles custom actions.

 eg. (in wp-admin/comment.php)

 {{{
 default:
         // there should be an existing wp_ajax_(action) added already.
         do_action( 'wp_ajax_' . $_POST['action'] );
         // do a wp_redirect here back to where it came from with helpful
 additional query arg
         break;
 }}}

 this way users that have not got javasript enabled can use the custom
 comment row action links and have native wordpress functions handle it
 instead of (like now) having the href of the link as "javascript:" or
 pointing to self and handling the custom action within the plugin on
 admin_init or load-edit-comments.php action

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


More information about the wp-trac mailing list