/** * 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) { $current_user = nxt_get_current_user(); if (empty($current_user)) { return false; } // Create new object to avoid stomping the global current_user. $user = new nxt_User($current_user->ID); // Set the blog id. @todo add blog id arg to nxt_User constructor? $user->for_blog($blog_id); $args = array_slice(func_get_args(), 2); $args = array_merge(array($capability), $args); return call_user_func_array(array(&$user, 'has_cap'), $args); }