Hi, I'm doing a customer integration with a mobile application subscription service. I have been through the documentation and it is clear how to query and update member records using the $db->xxx functions. What is not clear is how do I create a new member record in a pending state? I would have thought there would be a $db->create_user function (or equivalent). I expect the signup.php script must do this some how for new members, but in my application I have to replace the signup.php with my own script which interacts with a mobile device using a propriatary interface. Any help would be greatly appreciated.
@rjones: have you considered using the XML-RPC to interact with aMember.. it contains all of the functions you have mentioned.
No I hadn't. I'm not sure it is applicable. Here is some more context on my application. 1. I have a mobile app distributed from any number of sites and running on end user devices. 2. The mobile app issues a http get with a whole bunch of attributes in the url back to my site. 3. At my site sits a php script which pull subscriber id out of the attributes and accesses the aMember database. If the user is not in the database, I need to create him in a non paid state. 4. If the user is in the database, the script returns his subscription end date to the device which enforces the users entitlement to use the application. What I'm looking for is a simple api to create the user in the amember database if he/she is not already there. It's not clear to me how XML-RPC would help with this problem considering that the script accessed in step 2 is co-resident on my site with aMember and the aMember database. But I'm open to learn more if you think XML-RPC could help and can provide a link to more information which is contextualized to amember use. Thanks!
I just found the function add_pending_user in amember/plugins/db/mysql/mysql.inc.php. It looks like it does what I need it to do, but it is not mentioned in the online manual with the other $db functions. If I were to issue a call to $db->add_pending_user($vars) with the correct set of vars would this be a safe thing to do or would I be creating some other problems.
For what it is worth, the XML-RPC (amember/xml-rpc) does exactly what you are describing: it supports the following POST commands in the default one: Code: 'ping' => 'xmlrpc_ping', query' => 'xmlrpc_query', query_all' => 'xmlrpc_query_all', query_one' => 'xmlrpc_query_one', query_row' => 'xmlrpc_query_row', query_first' => 'xmlrpc_query_first', add_pending_user' => 'xmlrpc_add_pending_user', get_user' => 'xmlrpc_get_user', update_user' => 'xmlrpc_update_user', delete_user' => 'xmlrpc_delete_user', add_payment' => 'xmlrpc_add_payment', get_user_payments' => 'xmlrpc_get_user_payments', get_products_list' => 'xmlrpc_get_products_list', calculate_expiration' => 'xmlrpc_calculate_expiration', check_uniq_login' => 'xmlrpc_check_uniq_login', check_remote_access' => 'xmlrpc_check_remote_access', check_login' => 'xmlrpc_check_login', So in your situation you would make use of the "add_pending_user post. Given there are some other options such as "add_payment" in the stock one, you would probably want to modify it a bit to restrict functions from your mobile app.
This thread is the most useful set of information I have been able to find documenting the calls available with the XML-RPC library included with aMember. A couple questions for the gurus: -Is there another document that features all available commands? -The RPC-XML "plugin" referenced in the past is now included with aMember by default right? I am assuming that the higher version 2.x and 3.x have it since there is an optino under advanced to enable the library. Thanks
@lushtech: The gurus are out back smoking so I'll try and field your questions. 1) From an XML-RPC perspective I think my list above is still the full list (as of 3.23) 2) XML-RPC is not a plugin (as it does not exist at amember\plugins), but rather part of the core at amember\xmlrpc
You can enable it via the admin console -> setup / configuration -> advanced -> Enable XML-RPC Library re: docs.. I've listed the functions above in a previous post
Is there no documentation that has like add_payment examples or add_pending_user? I can't find any samples or anyway to figure out what data needs to be posted with those functions.
Both functions have one associative array as argument. For add_pending_user: PHP: $user = array('login'=>'', 'pass'=>'','email'=>'','name_f'=>'','name_l'=>''); for add_payment: PHP: $payment = array('member_id' => '', // User ID returned by add_pending_user call'product_id' => '','paysys_id' => '', // Payment plugin ID (for example paypal_r)'begin_date' => '', // Subscription begin date in format: yyyy-mm-dd'expire_date' => '', 'amount' => '','receipt_id' => '','completed' => '' // 1- yes, 0 -no);