mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
get_current_blog_id(). Props aaroncampbell. fixes #15233
git-svn-id: http://svn.automattic.com/wordpress/trunk@16050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b118cfabbc
commit
23948ab364
@ -387,7 +387,7 @@ EOD;
|
||||
* @since 2.2.0
|
||||
*/
|
||||
function create_post() {
|
||||
global $blog_id, $user_ID;
|
||||
global $user_ID;
|
||||
$this->get_accepted_content_type($this->atom_content_types);
|
||||
|
||||
$parser = new AtomParser();
|
||||
@ -419,7 +419,7 @@ EOD;
|
||||
if ( !current_user_can($cap) )
|
||||
$this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
|
||||
|
||||
$blog_ID = (int ) $blog_id;
|
||||
$blog_ID = get_current_blog_id();
|
||||
$post_status = ($publish) ? 'publish' : 'draft';
|
||||
$post_author = (int) $user_ID;
|
||||
$post_title = $entry->title[1];
|
||||
|
@ -7,8 +7,6 @@ class WP_Admin_Bar {
|
||||
var $user;
|
||||
|
||||
function initialize() {
|
||||
global $blog_id;
|
||||
|
||||
/* Only load super admin menu code if the logged in user is a super admin */
|
||||
if ( is_super_admin() ) {
|
||||
require( ABSPATH . WPINC . '/admin-bar/admin-bar-superadmin.php' );
|
||||
@ -28,7 +26,7 @@ class WP_Admin_Bar {
|
||||
$this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
|
||||
$this->user->account_domain = $this->user->domain;
|
||||
} else {
|
||||
$this->user->active_blog = $this->user->blogs[$blog_id];
|
||||
$this->user->active_blog = $this->user->blogs[get_current_blog_id()];
|
||||
$this->user->domain = trailingslashit( home_url() );
|
||||
$this->user->account_domain = $this->user->domain;
|
||||
}
|
||||
@ -85,7 +83,7 @@ class WP_Admin_Bar {
|
||||
function remove_menu( $id ) {
|
||||
return $this->remove_node( $id, $this->menu );
|
||||
}
|
||||
|
||||
|
||||
function render() {
|
||||
?>
|
||||
<div id="wpadminbar" class="snap_nopreview no-grav">
|
||||
|
@ -491,6 +491,18 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the current blog id
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @return int Blog id
|
||||
*/
|
||||
function get_current_blog_id() {
|
||||
global $blog_id;
|
||||
return absint($blog_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display or retrieve page title for all areas of blog.
|
||||
*
|
||||
|
@ -1016,7 +1016,7 @@ function register_post_type($post_type, $args = array()) {
|
||||
* behave like edit_posts.
|
||||
* - publish_posts - Controls publishing objects of this post type.
|
||||
* - read_private_posts - Controls whether private objects can be read.
|
||||
|
||||
|
||||
* These four primitive capabilities are checked in core in various locations.
|
||||
* There are also seven other primitive capabilities which are not referenced
|
||||
* directly in core, except in map_meta_cap(), which takes the three aforementioned
|
||||
@ -2265,11 +2265,11 @@ function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
|
||||
'meta_value' =>'', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private',
|
||||
'suppress_filters' => true
|
||||
);
|
||||
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
|
||||
$results = get_posts( $r );
|
||||
|
||||
|
||||
// Backward compatibility. Prior to 3.1 expected posts to be returned in array
|
||||
if ( ARRAY_A == $output ){
|
||||
foreach( $results as $key => $result ) {
|
||||
@ -4141,7 +4141,7 @@ function get_lastpostmodified($timezone = 'server') {
|
||||
* @return string The date.
|
||||
*/
|
||||
function _get_last_post_time( $timezone, $field ) {
|
||||
global $wpdb, $blog_id;
|
||||
global $wpdb;
|
||||
|
||||
if ( !in_array( $field, array( 'date', 'modified' ) ) )
|
||||
return false;
|
||||
@ -4152,7 +4152,7 @@ function _get_last_post_time( $timezone, $field ) {
|
||||
|
||||
$post_types = apply_filters( "get_lastpost{$field}_post_types", (array) $post_types );
|
||||
|
||||
$key = "lastpost{$field}:$blog_id:$timezone:" . md5( serialize( $post_types ) );
|
||||
$key = "lastpost{$field}:" . get_current_blog_id() . ":$timezone:" . md5( serialize( $post_types ) );
|
||||
|
||||
$date = wp_cache_get( $key, 'timeinfo' );
|
||||
|
||||
|
@ -376,7 +376,7 @@ class WP_User_Query extends WP_Object_Query {
|
||||
$this->query_vars = wp_parse_args( $query, array(
|
||||
'blog_id' => $GLOBALS['blog_id'],
|
||||
'role' => '',
|
||||
'meta_key' => '',
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'meta_compare' => '',
|
||||
'include' => array(),
|
||||
@ -572,10 +572,8 @@ function get_users( $args = array() ) {
|
||||
* @return array List of users that are part of that Blog ID
|
||||
*/
|
||||
function get_users_of_blog( $id = '' ) {
|
||||
global $blog_id;
|
||||
|
||||
if ( empty( $id ) )
|
||||
$id = (int) $blog_id;
|
||||
$id = get_current_blog_id();
|
||||
|
||||
return get_users( array( 'blog_id' => $id ) );
|
||||
}
|
||||
@ -593,7 +591,7 @@ function get_blogs_of_user( $id, $all = false ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( !is_multisite() ) {
|
||||
global $blog_id;
|
||||
$blog_id = get_current_blog_id();
|
||||
$blogs = array();
|
||||
$blogs[ $blog_id ]->userblog_id = $blog_id;
|
||||
$blogs[ $blog_id ]->blogname = get_option('blogname');
|
||||
@ -757,10 +755,10 @@ function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') {
|
||||
* @return array Includes a grand total and an array of counts indexed by role strings.
|
||||
*/
|
||||
function count_users($strategy = 'time') {
|
||||
global $wpdb, $blog_id, $wp_roles;
|
||||
global $wpdb, $wp_roles;
|
||||
|
||||
// Initialize
|
||||
$id = (int) $blog_id;
|
||||
$id = get_current_blog_id();
|
||||
$blog_prefix = $wpdb->get_blog_prefix($id);
|
||||
$result = array();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user