Changeset 19016 for trunk/wp-includes/user.php
- Timestamp:
- 10/19/2011 10:35:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/user.php
r19005 r19016 721 721 722 722 /** 723 * Checks if the current user belong to a given blog. 724 * 725 * @since MU 726 * 727 * @param int $blog_id Blog ID 728 * @return bool True if the current users belong to $blog_id, false if not. 729 */ 730 function is_blog_user( $blog_id = 0 ) { 731 global $wpdb; 732 733 if ( ! $blog_id ) 723 * Find out whether a user is a member of a given blog. 724 * 725 * @since MU 1.1 726 * @uses get_blogs_of_user() 727 * 728 * @param int $user_id The unique ID of the user 729 * @param int $blog Optional. If no blog_id is provided, current site is used 730 * @return bool 731 */ 732 function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) { 733 $user_id = (int) $user_id; 734 $blog_id = (int) $blog_id; 735 736 if ( empty( $user_id ) ) 737 $user_id = get_current_user_id(); 738 739 if ( empty( $blog_id ) ) { 740 global $wpdb; 734 741 $blog_id = $wpdb->blogid; 735 736 $blogs = get_blogs_of_user( get_current_user_id() ); 737 738 return is_array( $blogs ) && array_key_exists( $blog_id, $blogs ); 742 } 743 744 $blogs = get_blogs_of_user( $user_id ); 745 if ( is_array( $blogs ) ) 746 return array_key_exists( $blog_id, $blogs ); 747 else 748 return false; 739 749 } 740 750
Note: See TracChangeset
for help on using the changeset viewer.