From 63b2f4c6e756c3973214ee247012f40b5f29881b Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 30 Nov 2011 15:59:55 +0000 Subject: [PATCH] Cap checks for pointers. see #19360. git-svn-id: http://svn.automattic.com/wordpress/trunk@19488 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 7c10fe335a..ac7a7b8aa5 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1698,6 +1698,18 @@ final class WP_Internal_Pointers { $pointer = $registered_pointers[ $hook_suffix ]; + $caps_required = array( + 'wp330_media_uploader' => array( 'upload_files' ), + 'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ), + ); + + if ( isset( $caps_required[ $pointer ] ) ) { + foreach ( $caps_required[ $pointer ] as $cap ) { + if ( ! current_user_can( $cap ) ) + return; + } + } + // Get dismissed pointers $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );