Changeset 19016
- Timestamp:
- 10/19/2011 10:35:15 PM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/deprecated.php
r18907 r19016 2871 2871 } 2872 2872 } 2873 2874 /** 2875 * Checks if the current user belong to a given blog. 2876 * 2877 * @since MU 2878 * @deprecated 3.3 2879 * @deprecated Use is_user_member_of_blog() 2880 * @see is_user_member_of_blog() 2881 * 2882 * @param int $blog_id Blog ID 2883 * @return bool True if the current users belong to $blog_id, false if not. 2884 */ 2885 function is_blog_user( $blog_id = 0 ) { 2886 _deprecated_function( __FUNCTION__, '3.3', 'is_user_member_of_blog()' ); 2887 2888 return is_user_member_of_blog( get_current_user_id(), $blog_id ); 2889 } -
trunk/wp-includes/ms-functions.php
r18899 r19016 117 117 return $primary; 118 118 } 119 }120 121 /**122 * Find out whether a user is a member of a given blog.123 *124 * @since MU 1.1125 * @uses get_blogs_of_user()126 *127 * @param int $user_id The unique ID of the user128 * @param int $blog Optional. If no blog_id is provided, current site is used129 * @return bool130 */131 function is_user_member_of_blog( $user_id, $blog_id = 0 ) {132 $user_id = (int) $user_id;133 $blog_id = (int) $blog_id;134 135 if ( $blog_id == 0 ) {136 global $wpdb;137 $blog_id = $wpdb->blogid;138 }139 140 $blogs = get_blogs_of_user( $user_id );141 if ( is_array( $blogs ) )142 return array_key_exists( $blog_id, $blogs );143 else144 return false;145 119 } 146 120 -
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.