Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




current_user_can_for_blog [ WordPress Function ]

current_user_can_for_blog ( $blog_id, $capability )
Parameters:
  • (int) $blog_id Blog ID
  • (string) $capability Capability or role name.
Returns:
  • (bool)
Defined at:



Whether current user has a capability or role for a given blog.

Source


<?php
function current_user_can_for_blog$blog_id$capability ) {
    
$current_user wp_get_current_user();

    if ( empty( 
$current_user ) )
        return 
false;

    
// Create new object to avoid stomping the global current_user.
    
$user = new WP_User$current_user->ID) ;

    
// Set the blog id. @todo add blog id arg to WP_User constructor?
    
$user->for_blog$blog_id );

    
$args array_slicefunc_get_args(), );
    
$args array_merge( array( $capability ), $args );

    return 
call_user_func_array( array( &$user'has_cap' ), $args );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics