+ /**
+ * Log user in.
+ *
+ * @since 2.8
+ *
+ * @param string $username User's username.
+ * @param string $password User's password.
+ * @return mixed WP_User object if authentication passed, false otherwise
+ */
+ function login($username, $password) {
+ if ( !get_option( 'enable_xmlrpc' ) ) {
+ $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
+ return false;
+ }
+
+ $user = wp_authenticate($username, $password);
+
+ if (is_wp_error($user)) {
+ $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
+ return false;
+ }
+
+ set_current_user( $user->ID );
+ return $user;
+ }
+