Make WordPress Core


Ignore:
Timestamp:
10/13/2009 05:04:22 PM (16 years ago)
Author:
ryan
Message:

Embeds. Props Viper007Bond. see #10337

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r11929 r12023  
    961961
    962962/**
     963 * Whether author of supplied post has capability or role.
     964 *
     965 * @since 2.9
     966 *
     967 * @param int|object $post Post ID or post object.
     968 * @param string $capability Capability or role name.
     969 * @return bool
     970 */
     971function author_can( $post, $capability ) {
     972    if ( !$post = get_post($post) )
     973        return false;
     974
     975    $author = new WP_User( $post->post_author );
     976
     977    if ( empty( $author ) )
     978        return false;
     979
     980    $args = array_slice( func_get_args(), 2 );
     981    $args = array_merge( array( $capability ), $args );
     982
     983    return call_user_func_array( array( &$author, 'has_cap' ), $args );
     984}
     985
     986/**
    963987 * Retrieve role object.
    964988 *
Note: See TracChangeset for help on using the changeset viewer.