• I am writing a plugin to create users if they don’t exist, and the following code does not work correctly. Specifically, if I send wpmu_create_user() an email already in use, it will not return a WP_error object, simply FALSE.

    Now, if I use wp_create_user instead, I get the error. What would be the reasoning to use the WPMU function over the WP function?

    if(!username_exists( $user )){
            $user_id = wpmu_create_user($user, $pw, $email);
            if ( is_wp_error( $user_id ) )
            {
                $message = $user_id->get_error_message();
                myLog("Error: " .$message);
            }
            if ($user_id == false){
                myLog("Error creating user $user");
            } else {
                myLog("User id " . $user_id . " created successfully");
            }
        }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WPMU functions over WP functions?’ is closed to new replies.