Changeset 45708 for trunk/src/wp-includes/user.php
- Timestamp:
- 08/01/2019 11:27:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r45674 r45708 1469 1469 * Most of the `$userdata` array fields have filters associated with the values. Exceptions are 1470 1470 * 'ID', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 1471 * 'user_registered', and 'role'. The filters have the prefix 'pre_user_' followed by the field1472 * name. An example using 'description' would have the filter called, 'pre_user_description' that1473 * can be hooked into.1471 * 'user_registered', 'spam', and 'role'. The filters have the prefix 'pre_user_' followed by the 1472 * field name. An example using 'description' would have the filter called, 'pre_user_description' 1473 * that can be hooked into. 1474 1474 * 1475 1475 * @since 2.0.0 … … 1477 1477 * methods for new installations. See wp_get_user_contact_methods(). 1478 1478 * @since 4.7.0 The user's locale can be passed to `$userdata`. 1479 * @since 5.3.0 The `spam` field can be passed to `$userdata` (Multisite only). 1479 1480 * 1480 1481 * @global wpdb $wpdb WordPress database abstraction object. … … 1510 1511 * https. Default false. 1511 1512 * @type string $user_registered Date the user registered. Format is 'Y-m-d H:i:s'. 1513 * @type bool $spam Multisite only. Whether the user is marked as spam. 1514 * Default false. 1512 1515 * @type string|bool $show_admin_bar_front Whether to display the Admin Bar for the user on the 1513 1516 * site's front end. Default true. … … 1645 1648 return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) ); 1646 1649 } 1650 1651 if ( isset( $userdata['spam'] ) && ! is_multisite() ) { 1652 return new WP_Error( 'no_spam', __( 'Sorry, marking a user as spam is only supported on Multisite.' ) ); 1653 } 1654 1655 $spam = empty( $userdata['spam'] ) ? 0 : (bool) $userdata['spam']; 1656 1647 1657 $nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname']; 1648 1658 … … 1724 1734 $meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color ); 1725 1735 1726 $meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : $userdata['use_ssl'];1736 $meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : (bool) $userdata['use_ssl']; 1727 1737 1728 1738 $user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered']; … … 1751 1761 if ( ! $update ) { 1752 1762 $data = $data + compact( 'user_login' ); 1763 } 1764 1765 if ( is_multisite() ) { 1766 $data = $data + compact( 'spam' ); 1753 1767 } 1754 1768 … … 1849 1863 */ 1850 1864 do_action( 'profile_update', $user_id, $old_user_data ); 1865 1866 if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) { 1867 if ( $userdata['spam'] == 1 ) { 1868 /** 1869 * Fires after the user is marked as a SPAM user. 1870 * 1871 * @since 3.0.0 1872 * 1873 * @param int $user_id ID of the user marked as SPAM. 1874 */ 1875 do_action( 'make_spam_user', $user_id ); 1876 } else { 1877 /** 1878 * Fires after the user is marked as a HAM user. Opposite of SPAM. 1879 * 1880 * @since 3.0.0 1881 * 1882 * @param int $user_id ID of the user marked as HAM. 1883 */ 1884 do_action( 'make_ham_user', $user_id ); 1885 } 1886 } 1851 1887 } else { 1852 1888 /**
Note: See TracChangeset
for help on using the changeset viewer.