Using wordpress user accounts with an iOS app Using wordpress user accounts with an iOS app wordpress wordpress

Using wordpress user accounts with an iOS app


Figured out how to do it. You can do it with xml-rpc. Here's the code I have in my request plugin if anyone ever needs it:

function register_user($args){    require_once( ABSPATH . WPINC . '/registration.php' );/* Check if users can register. */$registration = get_option( 'users_can_register' );    /* If user registered, input info. */        $userdata = array(            'user_pass' => esc_attr( $args[2] ),            'user_login' => esc_attr( $args[0] ),            'first_name' => esc_attr( "" ),            'last_name' => esc_attr( "" ),            'nickname' => esc_attr( "" ),            'user_email' => esc_attr( $args[1] ),            'user_url' => esc_attr( "" ),            'aim' => esc_attr( "" ),            'yim' => esc_attr( ""),            'jabber' => esc_attr( "" ),            'description' => esc_attr( "" ),            'role' => get_option( 'default_role' ),        );        if ( !$userdata['user_login'] ){            $error = __('A username is required for registration.', 'frontendprofile');            return "user-invalid";              }elseif ( username_exists($userdata['user_login']) ){            $error = __('Sorry, that username already exists!', 'frontendprofile');            return "user-used";        }elseif ( !is_email($userdata['user_email'], true) ){            $error = __('You must enter a valid email address.', 'frontendprofile');            return "email-invalid";         }elseif ( email_exists($userdata['user_email']) ){            $error = __('Sorry, that email address is already used!', 'frontendprofile');            return "email-used";        }        else{            $new_user = wp_insert_user( $userdata );            wp_new_user_notification($new_user, $user_pass); //send the user an email with the information            return "success";        }     update_user_meta( $args[0]->ID, 'setup', "0" );}