Ticket #40922: 40922.6.diff
File 40922.6.diff, 3.1 KB (added by , 7 years ago) |
---|
-
src/wp-includes/capabilities.php
862 862 863 863 return $allcaps; 864 864 } 865 866 /** 867 * Filters the user capabilities to grant customize changeset capabilities as necessary. 868 * 869 * The capabilities are granted based on whether the user can 'edit_theme_options'. 870 * 871 * @since 4.9.0 872 * 873 * @param array $allcaps An array of all the user's capabilities. 874 * @return array Filtered array of the user's capabilities. 875 */ 876 function wp_maybe_grant_customize_changesets_capabilities( $allcaps ) { 877 if ( ! empty( $allcaps['edit_theme_options'] ) ) { 878 $post_type = get_post_type_object( 'customize_changeset' ); 879 foreach ( get_object_vars( $post_type->cap ) as $post_cap => $changeset_cap ) { 880 if ( '_posts' === substr( $post_cap, -6 ) ) { 881 $allcaps[ $changeset_cap ] = true; 882 } 883 } 884 } 885 886 return $allcaps; 887 } -
src/wp-includes/default-filters.php
514 514 515 515 // Capabilities 516 516 add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 ); 517 add_filter( 'user_has_cap', 'wp_maybe_grant_customize_changesets_capabilities', 1 ); 517 518 518 519 unset( $filter, $action ); -
src/wp-includes/post.php
176 176 'delete_with_user' => false, 177 177 'supports' => array( 'title', 'author' ), 178 178 'capability_type' => 'customize_changeset', 179 'capabilities' => array(180 'create_posts' => 'customize',181 'delete_others_posts' => 'customize',182 'delete_post' => 'customize',183 'delete_posts' => 'customize',184 'delete_private_posts' => 'customize',185 'delete_published_posts' => 'customize',186 'edit_others_posts' => 'customize',187 'edit_post' => 'customize',188 'edit_posts' => 'customize',189 'edit_private_posts' => 'customize',190 'edit_published_posts' => 'do_not_allow',191 'publish_posts' => 'customize',192 'read' => 'read',193 'read_post' => 'customize',194 'read_private_posts' => 'customize',195 ),196 179 ) ); 197 180 198 181 register_post_status( 'publish', array( … … 2964 2947 * @type string $guid Global Unique ID for referencing the post. Default empty. 2965 2948 * @type array $post_category Array of category names, slugs, or IDs. 2966 2949 * Defaults to value of the 'default_category' option. 2967 * @type array $tags_input Array of tag names, slugs, or IDs. Default empty. 2950 * @type array $tags_input Array of tag names, slugs, or IDs. Default empty. 2968 2951 * @type array $tax_input Array of taxonomy terms keyed by their taxonomy name. Default empty. 2969 2952 * @type array $meta_input Array of post meta values keyed by their post meta key. Default empty. 2970 2953 * }