[wp-trac] [WordPress Trac] #32739: Allow Non-administrators to Access the Customizer (was: Allow Non-administrators to Access the Customizer (Not Working))

WordPress Trac noreply at wordpress.org
Sat Jun 20 20:35:29 UTC 2015


#32739: Allow Non-administrators to Access the Customizer
--------------------------+------------------------------
 Reporter:  y2kand13      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Customize     |     Version:  4.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by ocean90):

 * version:  4.2.2 => 4.2


Old description:

> The following code added to function file is the stated way to provide
> access to the customizer for users with "edit_posts" capabilities.
>
> ********************************
>
> function allow_users_who_can_edit_posts_to_customize( $caps, $cap,
> $user_id ) {
>     $required_cap = 'edit_posts';
>     if ( 'customize' === $cap && user_can( $user_id, $required_cap ) ) {
>         $caps = array( $required_cap );
>     }
>     return $caps;
> }
> add_filter( 'map_meta_cap',
> 'allow_users_who_can_edit_posts_to_customize', 10, 3 );
>
> ********************************
>
> The Probblem; Outside of the admin, eligible users are shown the
> customizer link in the toolbar, but when they click the link they get
> "Cheating,'uh" accusation rather than the customizer.

New description:

 The following code added to function file is the stated way to provide
 access to the customizer for users with "edit_posts" capabilities.


 {{{
 function allow_users_who_can_edit_posts_to_customize( $caps, $cap,
 $user_id ) {
     $required_cap = 'edit_posts';
     if ( 'customize' === $cap && user_can( $user_id, $required_cap ) ) {
         $caps = array( $required_cap );
     }
     return $caps;
 }
 add_filter( 'map_meta_cap', 'allow_users_who_can_edit_posts_to_customize',
 10, 3 );
 }}}


 The Probblem; Outside of the admin, eligible users are shown the
 customizer link in the toolbar, but when they click the link they get
 "Cheating,'uh" accusation rather than the customizer.

--

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


More information about the wp-trac mailing list