summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-15 20:27:49 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-15 20:27:49 +0000
commit0bcdcd48b667dc42315f130ab1e0e87f0c5052c1 (patch)
tree8a1aae51f8ed1f8643e757ebbc0f78f1c79a5877 /wp-includes
parent1d6b7c9a990f68f0f9b599d61678c71d40251704 (diff)
downloadwordpress-mu-0bcdcd48b667dc42315f130ab1e0e87f0c5052c1.tar.gz
wordpress-mu-0bcdcd48b667dc42315f130ab1e0e87f0c5052c1.tar.xz
wordpress-mu-0bcdcd48b667dc42315f130ab1e0e87f0c5052c1.zip
Added "get_id_from_blogname()"
get_blog_details() can take blogname now. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1375 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/wpmu-functions.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index f30f986..e6f16f6 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -100,9 +100,24 @@ function get_user_details( $username ) {
return $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
}
+function get_id_from_blogname( $name ) {
+ global $wpdb, $current_site;
+ if( constant( 'VHOST' ) ) {
+ $domain = $name . '.' . $current_site->domain;
+ $path = $current_site->path;
+ } else {
+ $domain = $current_site->domain;
+ $path = $current_site->path . $name;
+ }
+ return $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = '$domain' AND path = '$path'" );
+}
+
function get_blog_details( $id, $getall = true ) {
global $wpdb;
+ if( !is_numeric( $id ) ) {
+ $id = get_id_from_blogname( $id );
+ }
$all = $getall == true ? '' : 'short';
$details = wp_cache_get( $id . $all, 'blog-details' );