[wp-trac] [WordPress Trac] #28451: current_user_can() not working properly in a network

WordPress Trac noreply at wordpress.org
Wed Jun 4 12:05:04 UTC 2014


#28451: current_user_can() not working properly in a network
-----------------------------+-----------------------------
 Reporter:  yurig            |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  3.9.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 In a WP network installation the current_user_can() function returns false
 even if the current user actually has the capability.

 eg.
 printing the $current_user global variable shows:

 {{{
 WP_User Object
 (
     ....

     [allcaps] => Array
         (
             [read] => 1
             [publish_posts] => 1
             [edit_posts] => 1
             [delete_posts] => 1
             [edit_published_posts] => 1
             [delete_published_posts] => 1
             [upload_files] => 1
             [unfiltered_html] => 1
             [level_0] => 1
             [level_1] => 1
             [level_2] => 1
             [author] => 1
         )
 )
 }}}

 Which shows that the user has the 'unfiltered_html' capability, but
 current_user_can('unfiltered_html') returns false.

 If it is useful, I am running this inside a 'mce_buttons' filter. The
 $current_user global is properly populated as shown above.

 Works fine on a single-site installation.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28451>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list