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

WordPress Trac noreply at wordpress.org
Thu Dec 19 22:19:07 UTC 2019


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

Comment (by pbiron):

 Replying to [comment:22 xkon]:
 > The attachment:44176.2.diff :
 >
 > Creates a new schema as `populate_roles_540()` that adds the 3 privacy
 caps to the administrator role by default & removes them from
 map_meta_cap.

 The other thing it should do is replace the 2 occurrences in
 `map_meta_cap()` (at the end of the case statements for
 `delete_{post,page}` and `edit_{post,page}`) of:

 {{{#!php
 <?php
 if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
         $caps = array_merge( $caps, map_meta_cap(
 'manage_privacy_options', $user_id ) );
 }
 }}}

 with:

 {{{#!php
 <?php
 if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
         $caps[] = 'manage_privacy_options';
 }
 }}}

 I can do a revised patch is you'd like.

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


More information about the wp-trac mailing list