+/**
+ * Whether current user has a capability or role for a given blog.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function current_user_can_for_blog( $blog_id, $capability ) {
+ if ( is_multisite() )
+ switch_to_blog( $blog_id );
+
+ $current_user = wp_get_current_user();
+
+ if ( empty( $current_user ) )
+ return false;
+
+ $args = array_slice( func_get_args(), 2 );
+ $args = array_merge( array( $capability ), $args );
+
+ $can = call_user_func_array( array( $current_user, 'has_cap' ), $args );
+
+ if ( is_multisite() )
+ restore_current_blog();
+
+ return $can;
+}
+
+/**
+ * Whether author of supplied post has capability or role.
+ *
+ * @since 2.9.0
+ *
+ * @param int|object $post Post ID or post object.
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function author_can( $post, $capability ) {
+ if ( !$post = get_post($post) )
+ return false;
+
+ $author = get_userdata( $post->post_author );
+
+ if ( ! $author )
+ return false;
+
+ $args = array_slice( func_get_args(), 2 );
+ $args = array_merge( array( $capability ), $args );
+
+ return call_user_func_array( array( $author, 'has_cap' ), $args );
+}
+
+/**
+ * Whether a particular user has capability or role.
+ *
+ * @since 3.1.0
+ *
+ * @param int|object $user User ID or object.
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function user_can( $user, $capability ) {
+ if ( ! is_object( $user ) )
+ $user = get_userdata( $user );
+
+ if ( ! $user || ! $user->exists() )
+ return false;
+
+ $args = array_slice( func_get_args(), 2 );
+ $args = array_merge( array( $capability ), $args );
+
+ return call_user_func_array( array( $user, 'has_cap' ), $args );
+}
+
+/**
+ * Retrieve role object.
+ *
+ * @see WP_Roles::get_role() Uses method to retrieve role object.
+ * @since 2.0.0
+ *
+ * @param string $role Role name.
+ * @return WP_Role|null WP_Role object if found, null if the role does not exist.
+ */
+function get_role( $role ) {