Difference between revisions of "NATS4 Site User Management"
TMMStephenY2 (talk | contribs) |
TMMStephenY2 (talk | contribs) |
||
Line 2: | Line 2: | ||
| show_sites_admin_section = true | | show_sites_admin_section = true | ||
}} | }} | ||
− | + | <!--THIS ARTICLE IS STILL BEING EDITED! THIS IS NOT FINISHED--> | |
[[NATS]] can send a postback script of your choosing every time a username gets added, removed, changed, expired, or checked. This is mostly used if you use an external verification script for checking user details. To use this postback script, go to the [[Sites Admin]], edit a tour of your choosing, and enter your script's URL in the Management URL field. | [[NATS]] can send a postback script of your choosing every time a username gets added, removed, changed, expired, or checked. This is mostly used if you use an external verification script for checking user details. To use this postback script, go to the [[Sites Admin]], edit a tour of your choosing, and enter your script's URL in the Management URL field. | ||
[[File:Management url.PNG|450px|User Management URL]] | [[File:Management url.PNG|450px|User Management URL]] | ||
+ | |||
+ | You can also prevent [[NATS]] from posting members' personal information through the user management postback script by using the [[NATS4 Sites Admin|Sites Admin]]. Simply edit the [[Ct#Site|site]] you want to affect, and check the "Disable Storing Personal Member Information" box on the Edit Program page. This will prevent information from the member_info table from being sent (i.e., first name, last name, address, etc.). | ||
Each request identifies what actions the particular user (based on username) took to trigger the script. Your script should reply with one of the following messages: | Each request identifies what actions the particular user (based on username) took to trigger the script. Your script should reply with one of the following messages: | ||
Line 17: | Line 19: | ||
== Username Actions == | == Username Actions == | ||
− | Certain actions in [[NATS]] will trigger your user management script. | + | Certain actions (calls) in [[NATS]] will trigger your user management script, returning a wide variety of parameters. The parameters passed in most of the user management calls will be similar, as a large amount of these parameters are taken from the [[NATS]] members table (i.e., memberid, status, joined, siteid, username, IP, etc.). |
+ | |||
+ | Additionally, most of these calls use identical parameters to pass back information. These calls are ''ACTIVATE'', ''MANUALADD'', ''DELETE'', and ''TRIALTOFULL''. | ||
=== ADD === | === ADD === | ||
Sent when a new username should be added to the user management | Sent when a new username should be added to the user management | ||
− | system. This sends the following extra parameters: | + | system for user access. This occurs when a new member registers on one of your [[Ct#Site|sites]]. |
− | password, | + | |
+ | This sends parameters from the members table, as well as the following extra parameters: | ||
+ | * ''member_subscription_id, memberidx, billerid, statid, cost, cost_charge, spent, refunded, charges, next_rebill, optionid, rebills, active, expires, nats_expires, biller_expires, original_optionid, created_date, loginid_assigned, identid_assigned, member_identid, member_loginid, country, xsell_success, last_modified, mychanges_username/password/status/trial/mailok/marked, new_status/trial/mailok/marked, siteid, username'' | ||
=== MANUALADD === | === MANUALADD === | ||
− | Sent when a username is manually added via the | + | Sent when a username is manually added via the [[NATS4 Members Admin|members admin]] or through a biller refresh. |
− | [[Members Admin|members admin]] or through a biller refresh. | + | |
− | This sends the | + | This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. |
− | |||
=== ACTIVATE === | === ACTIVATE === | ||
Sent when a user has rebilled through the biller. This is used to record a | Sent when a user has rebilled through the biller. This is used to record a | ||
− | rebill, or to convert a member from a trial membership to a full membership. This sends the | + | rebill, or to convert a member from a trial membership to a full membership. |
+ | |||
+ | This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. | ||
=== TRIALTOFULL === | === TRIALTOFULL === | ||
− | Sent when a user | + | Sent when a user upgrades from a trial to a full membership. |
− | full membership. This sends the | + | |
+ | This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. | ||
'''Note''': Your script might be run more than once when doing a [[Ct#Conversion|conversion]]. | '''Note''': Your script might be run more than once when doing a [[Ct#Conversion|conversion]]. | ||
Line 42: | Line 50: | ||
=== CHANGE === | === CHANGE === | ||
Sent when a current username or password should be changed to a new | Sent when a current username or password should be changed to a new | ||
− | username or password. This sends | + | username or password. This will only pass back a new username or new password if there is a new value for either. |
− | + | ||
+ | This sends a few different parameters from other other user management calls. The "CHANGE" call also sends parameters such as ''new_username, new_password, new_cryptpass, new_token'', etc. | ||
=== DELETE === | === DELETE === | ||
Sent when a user's account should be immediately removed from the | Sent when a user's account should be immediately removed from the | ||
− | active user list. This sends the | + | active user list. |
− | + | ||
+ | This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. | ||
=== EXPIRE === | === EXPIRE === | ||
Sent when a user's account should be expired on the provided date. The | Sent when a user's account should be expired on the provided date. The | ||
− | date might be in the past. This sends the | + | date might be in the past. |
− | + | ||
+ | This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. This call also sends the ''expire'' parameter, expressed in YYYY-MM-DD format. | ||
=== CHECK === | === CHECK === | ||
− | Sent to check if a username is available. | + | Sent to check if a username is available, or already exists in your [[NATS]] database. |
'''NOTE: If the username does exist, the reply should be "OK". If the username does not exist, the reply should be "NOTOK".''' <br> | '''NOTE: If the username does exist, the reply should be "OK". If the username does not exist, the reply should be "NOTOK".''' <br> | ||
− | This sends the following | + | |
+ | This sends the following parameters: username and siteid. | ||
== Error Logging == | == Error Logging == |
Revision as of 15:47, 26 August 2010
NATS can send a postback script of your choosing every time a username gets added, removed, changed, expired, or checked. This is mostly used if you use an external verification script for checking user details. To use this postback script, go to the Sites Admin, edit a tour of your choosing, and enter your script's URL in the Management URL field.
You can also prevent NATS from posting members' personal information through the user management postback script by using the Sites Admin. Simply edit the site you want to affect, and check the "Disable Storing Personal Member Information" box on the Edit Program page. This will prevent information from the member_info table from being sent (i.e., first name, last name, address, etc.).
Each request identifies what actions the particular user (based on username) took to trigger the script. Your script should reply with one of the following messages:
- OK|message
- NOTOK|message
- ERROR|message
Replace "message" with a detailed explanation of your choosing.
Username Actions
Certain actions (calls) in NATS will trigger your user management script, returning a wide variety of parameters. The parameters passed in most of the user management calls will be similar, as a large amount of these parameters are taken from the NATS members table (i.e., memberid, status, joined, siteid, username, IP, etc.).
Additionally, most of these calls use identical parameters to pass back information. These calls are ACTIVATE, MANUALADD, DELETE, and TRIALTOFULL.
ADD
Sent when a new username should be added to the user management system for user access. This occurs when a new member registers on one of your sites.
This sends parameters from the members table, as well as the following extra parameters:
- member_subscription_id, memberidx, billerid, statid, cost, cost_charge, spent, refunded, charges, next_rebill, optionid, rebills, active, expires, nats_expires, biller_expires, original_optionid, created_date, loginid_assigned, identid_assigned, member_identid, member_loginid, country, xsell_success, last_modified, mychanges_username/password/status/trial/mailok/marked, new_status/trial/mailok/marked, siteid, username
MANUALADD
Sent when a username is manually added via the members admin or through a biller refresh.
This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call.
ACTIVATE
Sent when a user has rebilled through the biller. This is used to record a rebill, or to convert a member from a trial membership to a full membership.
This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call.
TRIALTOFULL
Sent when a user upgrades from a trial to a full membership.
This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call.
Note: Your script might be run more than once when doing a conversion.
CHANGE
Sent when a current username or password should be changed to a new username or password. This will only pass back a new username or new password if there is a new value for either.
This sends a few different parameters from other other user management calls. The "CHANGE" call also sends parameters such as new_username, new_password, new_cryptpass, new_token, etc.
DELETE
Sent when a user's account should be immediately removed from the active user list.
This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call.
EXPIRE
Sent when a user's account should be expired on the provided date. The date might be in the past.
This sends the available parameters from the members table, as well as the additional parameters sent by the "ADD" user management call. This call also sends the expire parameter, expressed in YYYY-MM-DD format.
CHECK
Sent to check if a username is available, or already exists in your NATS database.
NOTE: If the username does exist, the reply should be "OK". If the username does not exist, the reply should be "NOTOK".
This sends the following parameters: username and siteid.
Error Logging
If the reply is "ERROR", NATS will add the error to the surfer's note so you can see the problem in the Members Admin.
Sample Script
You may use the following sample script provided by Tanguy de Courson.
/** * A password authentication script for the NATS user management feature * where NATS posts the authentication to your authentication script * * NB: all functions MUST print out * OK|~message~ * or * NOTOK|~message~ * or * ERROR|~message~ * * @author Tanguy de Courson * **/ switch(@$_REQUEST['action']) { /** * Additional parameters: memberid, username, password, email, siteid, biller, trial * This call is done whenever a new username should be added to the user management for access. */ case 'ADD': add_user(); break; /** * Additional parameters: memberid, username, password, email, siteid, biller, trial * This call is done whenever a new username should be added to the user management for access. * This is generally done when reactivating someone who has been removed. */ case 'ACTIVATE': add_user(); break; /** * Additional parameters: memberid, username, password, siteid, biller, trial * This call is done whenever a username is manually added via the members admin or a biller refresh. **/ case 'MANUALADD': add_user(); break; /** * Additional parameters: memberid, username, siteid, biller * This call is done whenever a user changes from trial to full membership. **/ case 'TRIALTOFULL': upgrade_user(); break; /** * Additional parameters: memberid, username, siteid, biller, new_username, new_password * This call is done whenever an old username should be updated to a new username and/or password. **/ case 'CHANGE': change_password(); break; /** * Additional parameters: memberid, username, siteid, biller * This call is done whenever a current user should be immediately removed from the active user list. **/ case 'DELETE': delete_user(); break; /** * Additional parameters: memberid, username, siteid, biller, expire (YYYY-MM-DD format) * This call is done when a current user should be expired on a given date. The date MIGHT be in the past. **/ case 'EXPIRE': expire_user(); break; /** * Additional parameters: username, siteid * This call is done to verify if a username is still available. If the username DOES exist, the reply should be OK. If the username DOES NOT exist, the reply should be NOTOK. **/ case 'CHECK': check_user(); break; } function add_user() { } function upgrade_user() { } function change_password() { } function delete_user() { } function expire_user() { } function check_user() { }