Changeset 27353
- Timestamp:
- 03/02/2014 07:39:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r27351 r27353 4 4 * 5 5 * @package WordPress 6 * @subpackage Users 6 7 */ 7 8 … … 21 22 * @param array $credentials Optional. User info in order to sign on. 22 23 * @param bool $secure_cookie Optional. Whether to use secure cookie. 23 * @return object Either WP_Error on failure, or WP_User on success.24 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 24 25 */ 25 26 function wp_signon( $credentials = array(), $secure_cookie = '' ) { … … 38 39 $credentials['remember'] = false; 39 40 40 // TODO do we deprecate the wp_authentication action?41 41 /** 42 42 * Fires before the user is authenticated. … … 46 46 * 47 47 * @since 1.5.1 48 * 49 * @todo Decide whether to deprecate the wp_authenticate action. 48 50 * 49 51 * @param string $user_login Username, passed by reference. … … 102 104 /** 103 105 * Authenticate the user using the username and password. 106 * 107 * @since 2.8.0 108 * 109 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 110 * @param string $username Username for authentication. 111 * @param string $password Password for authentication. 112 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 104 113 */ 105 114 function wp_authenticate_username_password($user, $username, $password) { … … 150 159 /** 151 160 * Authenticate the user using the WordPress auth cookie. 161 * 162 * @since 2.8.0 163 * 164 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 165 * @param string $username Username. If passed, cancels the cookie authentication. 166 * @param string $password Password. If passed, cancels the cookie authentication. 167 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 152 168 */ 153 169 function wp_authenticate_cookie($user, $username, $password) { … … 178 194 179 195 /** 180 * For multisite blogs, check if the authenticated user has been marked as a196 * For Multisite blogs, check if the authenticated user has been marked as a 181 197 * spammer, or if the user's primary blog has been marked as spam. 182 198 * 183 199 * @since 3.7.0 200 * 201 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 202 * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer. 184 203 */ 185 204 function wp_authenticate_spam_check( $user ) { … … 205 224 * 206 225 * @since 3.0.0 207 * @uses $wpdb WordPress database object for queries. 226 * 227 * @global wpdb $wpdb WordPress database object for queries. 208 228 * 209 229 * @param int $userid User ID. … … 292 312 * 293 313 * @since 2.0.0 294 * @uses $wpdb WordPress database object for queries. 295 * @uses apply_filters() Calls 'get_user_option_$option' hook with result, 296 * option parameter, and user data object. 297 * 298 * @param string $option User option name. 299 * @param int $user Optional. User ID. 300 * @param bool $deprecated Use get_option() to check for an option in the options table. 301 * @return mixed 314 * 315 * @global wpdb $wpdb WordPress database object for queries. 316 * 317 * @param string $option User option name. 318 * @param int $user Optional. User ID. 319 * @param bool $deprecated Use get_option() to check for an option in the options table. 320 * @return mixed User option value on success, false on failure. 302 321 */ 303 322 function get_user_option( $option, $user = 0, $deprecated = '' ) { … … 345 364 * 346 365 * @since 2.0.0 347 * @uses $wpdb WordPress database object for queries 348 * 349 * @param int $user_id User ID 366 * 367 * @global wpdb $wpdb WordPress database object for queries. 368 * 369 * @param int $user_id User ID. 350 370 * @param string $option_name User option name. 351 * @param mixed $newvalue User option value. 352 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 353 * @return unknown 371 * @param mixed $newvalue User option value. 372 * @param bool $global Optional. Whether option name is global or blog specific. 373 * Default false (blog specific). 374 * @return int|bool User meta ID if the option didn't exist, true on successful update, 375 * false on failure. 354 376 */ 355 377 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { … … 370 392 * 371 393 * @since 3.0.0 372 * @uses $wpdb WordPress database object for queries 373 * 374 * @param int $user_id User ID 394 * 395 * @global wpdb $wpdb WordPress database object for queries. 396 * 397 * @param int $user_id User ID 375 398 * @param string $option_name User option name. 376 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 377 * @return unknown 399 * @param bool $global Optional. Whether option name is global or blog specific. 400 * Default false (blog specific). 401 * @return bool True on success, false on failure. 378 402 */ 379 403 function delete_user_option( $user_id, $option_name, $global = false ) { … … 427 451 428 452 /** 429 * PHP5 constructor 453 * PHP5 constructor. 430 454 * 431 455 * @since 3.1.0 432 456 * 433 * @param string|array $args The query variables457 * @param string|array $args Optional. The query variables. 434 458 * @return WP_User_Query 435 459 */ … … 442 466 443 467 /** 444 * Prepare the query variables 468 * Prepare the query variables. 445 469 * 446 470 * @since 3.1.0 447 471 * 448 * @param string|array $args The query variables472 * @param string|array $args Optional. The query variables. 449 473 */ 450 474 function prepare_query( $query = array() ) { … … 654 678 655 679 /** 656 * Execute the query, with the current variables 680 * Execute the query, with the current variables. 657 681 * 658 682 * @since 3.1.0 683 * 684 * @global wpdb $wpdb WordPress database object for queries. 659 685 */ 660 686 function query() { … … 759 785 760 786 /** 761 * Return the list of users 787 * Return the list of users. 762 788 * 763 789 * @since 3.1.0 764 790 * @access public 765 791 * 766 * @return array 792 * @return array Array of results. 767 793 */ 768 794 function get_results() { … … 771 797 772 798 /** 773 * Return the total number of users for the current query 799 * Return the total number of users for the current query. 774 800 * 775 801 * @since 3.1.0 776 802 * @access public 777 803 * 778 * @return array 804 * @return array Array of total users. 779 805 */ 780 806 function get_total() { … … 787 813 * 788 814 * @since 3.1.0 789 * @uses $wpdb815 * 790 816 * @uses WP_User_Query See for default arguments and information. 791 817 * 792 * @param array $args Optional. 818 * @param array $args Optional. Array of arguments. 793 819 * @return array List of users. 794 820 */ … … 808 834 * @since 3.0.0 809 835 * 810 * @param int $user_id User ID 811 * @param bool $all Whether to retrieve all blogs, or only blogs that are not marked as deleted, archived, or spam. 812 * @return array A list of the user's blogs. An empty array if the user doesn't exist or belongs to no blogs. 836 * @global wpdb $wpdb WordPress database object for queries. 837 * 838 * @param int $user_id User ID 839 * @param bool $all Whether to retrieve all blogs, or only blogs that are not 840 * marked as deleted, archived, or spam. 841 * @return array A list of the user's blogs. An empty array if the user doesn't exist 842 * or belongs to no blogs. 813 843 */ 814 844 function get_blogs_of_user( $user_id, $all = false ) { … … 1155 1185 * 1156 1186 * @since 2.3.0 1157 * @uses $wpdb WordPress database object for queries 1158 * 1159 * @param string|array $args Optional. Override defaults. 1187 * 1188 * @global wpdb $wpdb WordPress database object for queries. 1189 * 1190 * @todo Hash-notate arguments array. 1191 * 1192 * @param string|array $args Optional. Array of user arguments. 1160 1193 * @return string|null Null on display. String of HTML content on retrieve. 1161 1194 */ … … 1240 1273 * 1241 1274 * @since 2.3.0 1242 * @uses apply_filters() Calls 'edit_$field' passing $value and $user_id if $context == 'edit'.1243 * $field is prefixed with 'user_' if it isn't already.1244 * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db'. $field is prefixed with1245 * 'user_' if it isn't already.1246 * @uses apply_filters() Calls '$field' passing $value, $user_id and $context if $context == anything1247 * other than 'raw', 'edit' and 'db'. $field is prefixed with 'user_' if it isn't already.1248 1275 * 1249 1276 * @param string $field The user Object field name. … … 1269 1296 if ( 'edit' == $context ) { 1270 1297 if ( $prefixed ) { 1298 1271 1299 /** This filter is documented in wp-includes/post.php */ 1272 1300 $value = apply_filters( "edit_{$field}", $value, $user_id ); 1273 1301 } else { 1302 1274 1303 /** 1275 1304 * Filter a user field value in the 'edit' context. … … 1295 1324 $value = apply_filters( "pre_{$field}", $value ); 1296 1325 } else { 1326 1297 1327 /** 1298 1328 * Filter the value of a user field in the 'db' context. … … 1309 1339 } else { 1310 1340 // Use display filters by default. 1311 if ( $prefixed ){ 1341 if ( $prefixed ) { 1342 1312 1343 /** This filter is documented in wp-includes/post.php */ 1313 1344 $value = apply_filters( $field, $value, $user_id, $context ); 1314 }else{ 1345 } else { 1346 1315 1347 /** 1316 1348 * Filter the value of a user field in a standard context. … … 1394 1426 * 1395 1427 * @since 2.1.0 1396 * @uses $wpdb1397 1428 * 1398 1429 * @param string $email Email. … … 1461 1492 * 1462 1493 * @since 2.0.0 1463 * @uses $wpdb WordPress database layer.1464 * @ uses apply_filters() Calls filters for most of the $userdata fields with the prefix 'pre_user'. See note above.1465 * @uses do_action() Calls 'profile_update' hook when updating giving the user's ID1466 * @ uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID1494 * 1495 * @global wpdb $wpdb WordPress database object for queries. 1496 * 1497 * @todo Hash-notate arguments array. 1467 1498 * 1468 1499 * @param mixed $userdata An array of user data or a user object of type stdClass or WP_User. … … 1491 1522 1492 1523 $user_login = sanitize_user($user_login, true); 1524 1493 1525 /** 1494 1526 * Filter a username after it has been sanitized. … … 1513 1545 if ( empty($user_nicename) ) 1514 1546 $user_nicename = sanitize_title( $user_login ); 1547 1515 1548 /** 1516 1549 * Filter a user's nicename before the user is created or updated. … … 1524 1557 if ( empty($user_url) ) 1525 1558 $user_url = ''; 1559 1526 1560 /** 1527 1561 * Filter a user's URL before the user is created or updated. … … 1535 1569 if ( empty($user_email) ) 1536 1570 $user_email = ''; 1571 1537 1572 /** 1538 1573 * Filter a user's email before the user is created or updated. … … 1549 1584 if ( empty($nickname) ) 1550 1585 $nickname = $user_login; 1586 1551 1587 /** 1552 1588 * Filter a user's nickname before the user is created or updated. … … 1560 1596 if ( empty($first_name) ) 1561 1597 $first_name = ''; 1598 1562 1599 /** 1563 1600 * Filter a user's first name before the user is created or updated. … … 1571 1608 if ( empty($last_name) ) 1572 1609 $last_name = ''; 1610 1573 1611 /** 1574 1612 * Filter a user's last name before the user is created or updated. … … 1593 1631 $display_name = $user_login; 1594 1632 } 1633 1595 1634 /** 1596 1635 * Filter a user's display name before the user is created or updated. … … 1604 1643 if ( empty($description) ) 1605 1644 $description = ''; 1645 1606 1646 /** 1607 1647 * Filter a user's description before the user is created or updated. … … 1704 1744 * 1705 1745 * @since 2.0.0 1706 * @see wp_insert_user() For what fields can be set in $userdata 1746 * 1747 * @see wp_insert_user() For what fields can be set in $userdata. 1707 1748 * 1708 1749 * @param mixed $userdata An array of user data or a user object of type stdClass or WP_User. … … 1842 1883 * but have a different WP_Error code so good user feedback can be provided. 1843 1884 * 1844 * @ uses $wpdb WordPress Database object1885 * @global wpdb $wpdb WordPress database object for queries. 1845 1886 * 1846 1887 * @param string $key Hash to validate sending user's password.
Note: See TracChangeset
for help on using the changeset viewer.