Changeset 23438
- Timestamp:
- 02/16/2013 03:02:15 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/ms-deprecated.php
r21480 r23438 271 271 return $url; 272 272 } 273 274 /** 275 * Get a numeric user ID from either an email address or a login. 276 * 277 * A numeric string is considered to be an existing user ID 278 * and is simply returned as such. 279 * 280 * @since MU 281 * @deprecated 3.6.0 282 * @deprecated Use get_user_by() 283 * @uses get_user_by() 284 * 285 * @param string $string Either an email address or a login. 286 * @return int 287 */ 288 function get_user_id_from_string( $string ) { 289 _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' ); 290 291 if ( is_email( $string ) ) 292 $user = get_user_by( 'email', $string ); 293 elseif ( is_numeric( $string ) ) 294 return $string; 295 else 296 $user = get_user_by( 'login', $string ); 297 298 if ( $user ) 299 return $user->ID; 300 return 0; 301 } -
trunk/wp-includes/ms-functions.php
r23432 r23438 909 909 910 910 $user = new WP_User( $user_id ); 911 911 912 912 // Newly created users have no roles or caps until they are added to a blog. 913 913 delete_user_option( $user_id, $user->cap_key ); … … 1315 1315 global $current_site; 1316 1316 return $current_site; 1317 }1318 1319 /**1320 * Get a numeric user ID from either an email address or a login.1321 *1322 * @since MU1323 * @uses is_email()1324 *1325 * @param string $string1326 * @return int1327 */1328 function get_user_id_from_string( $string ) {1329 $user_id = 0;1330 if ( is_email( $string ) ) {1331 $user = get_user_by('email', $string);1332 if ( $user )1333 $user_id = $user->ID;1334 } elseif ( is_numeric( $string ) ) {1335 $user_id = $string;1336 } else {1337 $user = get_user_by('login', $string);1338 if ( $user )1339 $user_id = $user->ID;1340 }1341 1342 return $user_id;1343 1317 } 1344 1318 … … 1731 1705 1732 1706 /** 1733 * Check to see whether a user is marked as a spammer, based on user name1707 * Check to see whether a user is marked as a spammer, based on user login. 1734 1708 * 1735 1709 * @since MU 1736 1710 * @uses get_user_by() 1737 1711 * 1738 * @param string $user name1712 * @param string $user_login Optional. Defaults to current user. 1739 1713 * @return bool 1740 1714 */ 1741 function is_user_spammy( $username = 0 ) { 1742 if ( $username == 0 ) { 1715 function is_user_spammy( $user_login = null ) { 1716 if ( $user_login ) 1717 $user = get_user_by( 'login', $user_login ); 1718 else 1743 1719 $user = wp_get_current_user(); 1744 } else { 1745 $user = get_user_by( 'login', $username ); 1746 } 1747 1748 return ( isset( $user->spam ) && $user->spam == 1 ); 1720 1721 return $user && isset( $user->spam ) && 1 == $user->spam; 1749 1722 } 1750 1723
Note: See TracChangeset
for help on using the changeset viewer.