1

I am writing an android (and eventually iphone) app that is proposing to register a user to a wordpress site. The intent is to have the user registration solely through the mobile device and not through a website front end. The app will update the wordpress site and the user will be able to login in to see his data. I have a general idea on how to use the wp hooks with json to do the mobile registration. However, is there a way to the registration process without enabling "anyone can register" in "general/settings"? (note: I looked through all the questions using "Mobile User Registration" but did not see any related.). Thanks in advance

  • Look at XML-RPC, then please come back and file an edit with your research and your try/errors. – kaiser Apr 10 '14 at 15:43
  • Had you tried it? I am not sure this setting actually prevents you from creating user with code. – Rarst Apr 10 '14 at 18:44
  • I'm in the process of setting up an android app (Was hoping to get an answer first :-) ). My impression from the code at the link below is that the setting is as you suspect. android.svn.wordpress.org/tags/2.0/src/org/wordpress/android/… – user1530230 Apr 11 '14 at 0:21
1

New users CAN be allowed to register remotely without setting "anyone can register" in "general/settings". The client is android and in addition to the android java client code using the 'org.xmlrpc library', the following was added to 'functions.php' in the child theme:

function xml_add_method( $methods ) {
    $methods['xxx.wp_create_user'] = 'xxx_wp_create_user';
    return $methods;
}

add_filter( 'xmlrpc_methods', 'xml_add_method');

function xxx_wp_create_user( $args ) {
    $uname = $args[1];
    $pword = $args[2];
    $email = $args[3];
   $user_id = wp_create_user( $uname, $pword, $email ); 
   return $user_id;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.