bp_core_signup_user( string $user_login, string $user_password, string $user_email, array $usermeta )
Process data submitted at user registration and convert to a signup object.
Description
Parameters
- $user_login
-
(Required) Login name requested by the user.
- $user_password
-
(Required) Password requested by the user.
- $user_email
-
(Required) Email address entered by the user.
- $usermeta
-
(Required) Miscellaneous metadata about the user (blog-specific signup data, xprofile data, etc).
Return
(int|false) True on success, WP_Error on failure.
Source
File: bp-members/bp-members-functions.php
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | function bp_core_signup_user( $user_login , $user_password , $user_email , $usermeta ) { $bp = buddypress(); // We need to cast $user_id to pass to the filters. $user_id = false; // Multisite installs have their own install procedure. if ( is_multisite() ) { wpmu_signup_user( $user_login , $user_email , $usermeta ); } else { // Format data. $user_login = preg_replace( '/\s+/' , '' , sanitize_user( $user_login , true ) ); $user_email = sanitize_email( $user_email ); $activation_key = wp_generate_password( 32, false ); /** * WordPress's default behavior is to create user accounts * immediately at registration time. BuddyPress uses a system * borrowed from WordPress Multisite, where signups are stored * separately and accounts are only created at the time of * activation. For backward compatibility with plugins that may * be anticipating WP's default behavior, BP silently creates * accounts for registrations (though it does not use them). If * you know that you are not running any plugins dependent on * these pending accounts, you may want to save a little DB * clutter by defining setting the BP_SIGNUPS_SKIP_USER_CREATION * to true in your wp-config.php file. */ if ( ! defined( 'BP_SIGNUPS_SKIP_USER_CREATION' ) || ! BP_SIGNUPS_SKIP_USER_CREATION ) { $user_id = BP_Signup::add_backcompat( $user_login , $user_password , $user_email , $usermeta ); if ( is_wp_error( $user_id ) ) { return $user_id ; } bp_update_user_meta( $user_id , 'activation_key' , $activation_key ); } $args = array ( 'user_login' => $user_login , 'user_email' => $user_email , 'activation_key' => $activation_key , 'meta' => $usermeta , ); BP_Signup::add( $args ); /** * Filters if BuddyPress should send an activation key for a new signup. * * @since BuddyPress 1.2.3 * * @param bool $value Whether or not to send the activation key. * @param int $user_id User ID to send activation key to. * @param string $user_email User email to send activation key to. * @param string $activation_key Activation key to be sent. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). */ if ( apply_filters( 'bp_core_signup_send_activation_key' , true, $user_id , $user_email , $activation_key , $usermeta ) ) { bp_core_signup_send_validation_email( $user_id , $user_email , $activation_key , $user_login ); } } $bp ->signup->username = $user_login ; /** * Fires at the end of the process to sign up a user. * * @since BuddyPress 1.2.2 * * @param bool|WP_Error $user_id True on success, WP_Error on failure. * @param string $user_login Login name requested by the user. * @param string $user_password Password requested by the user. * @param string $user_email Email address requested by the user. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). */ do_action( 'bp_core_signup_user' , $user_id , $user_login , $user_password , $user_email , $usermeta ); return $user_id ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.