[wp-trac] [WordPress Trac] #44176: Un-map Privacy Capabilities

WordPress Trac noreply at wordpress.org
Tue Dec 11 21:38:44 UTC 2018


#44176: Un-map Privacy Capabilities
-------------------------------------+------------------------------
 Reporter:  desrosj                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Privacy                  |     Version:  4.9.6
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |     Focuses:
-------------------------------------+------------------------------

Comment (by ianatkins):

 Agree that giving the DPO admin rights is a recipe for disaster. Am trying
 to enable the privacy tools for the editor role.

 @flixos90 you mention it's an architectural issue. Have tried the filter
 you suggested ( code below ), this now gives an editor the 'tools' option
 in the menu that only redirects back to the dashboard and has no sub
 menus. Correct me if I'm missing something, or that's not the right
 filter.

 I can only get it this to work by granting manage_options via the members
 plugin, which is less than ideal.

 {{{#!php
 function editor_cap_filter( $caps, $cap, $args ) {

         // Bail out for users who can't publish posts:
         if ( !isset( $caps['publish_posts'] ) or !$caps['publish_posts'] )
                 return $caps;

         // Add Privacy Capabilties
         $caps[] ='erase_others_personal_data';
         $caps[] ='export_others_personal_data';
         $caps[] ='manage_privacy_options';

         return $caps;

 }

 add_filter( 'user_has_cap', 'editor_cap_filter', 10, 3 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44176#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list