Difference between revisions of "NATS4 Site User Management"
TMMStephenY2 (talk | contribs) |
TMMStephenY2 (talk | contribs) |
||
Line 3: | Line 3: | ||
}} | }} | ||
− | [[NATS]] can send a postback script of your choosing every time a username gets added, removed, changed, expired, or checked. | + | [[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]] | ||
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 14: | Line 16: | ||
== Username Actions == | == Username Actions == | ||
+ | |||
+ | Certain actions in [[NATS]] will trigger your user management script. | ||
=== 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. | + | system. This sends the following extra parameters: memberid, username, |
− | password, email, | + | password, email, siteid, [[Biller|biller]], and trial. |
=== MANUALADD === | === MANUALADD === | ||
Sent when a username is manually added via the | Sent when a username is manually added via the | ||
− | [[Members Admin|members admin]] or a biller refresh. | + | [[Members Admin|members admin]] or through a biller refresh. |
− | + | This sends the following extra parameters: memberid, username, password, | |
− | siteid, biller, trial. | + | siteid, biller, and trial. |
=== ACTIVATE === | === ACTIVATE === | ||
− | + | Sent when a user has rebilled through the biller. This is used to record a | |
− | rebill or convert a member from a trial membership to a full | + | rebill, or to convert a member from a trial membership to a full membership. This sends the following extra parameters: memberid, username, password, siteid, biller, and trial. |
− | membership. | ||
− | username, password, siteid, biller, trial. | ||
=== TRIALTOFULL === | === TRIALTOFULL === | ||
− | Sent when a user changes from | + | Sent when a user changes from trial to |
− | + | full membership. This sends the following extra parameters: memberid, username, siteid, and biller. | |
− | parameters: memberid, username, siteid, biller. | ||
− | Note: | + | '''Note''': Your script might be run more than once when doing a [[Ct#Conversion|conversion]]. |
=== 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. | + | username or password. This sends the following extra parameters: memberid, |
− | username, siteid, biller, new_username, new_password. | + | username, siteid, biller, new_username, and new_password. |
=== 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. | + | active user list. This sends the following extra parameters: memberid, username, |
− | siteid, biller. | + | siteid, and biller. |
=== 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. | + | date might be in the past. This sends the following extra parameters: |
− | memberid, username, siteid, biller, expire (YYYY-MM-DD format). | + | memberid, username, siteid, biller, and expire (expressed in YYYY-MM-DD format). |
=== CHECK === | === CHECK === | ||
Sent to check if a username is available.<br> | Sent to check if a username is available.<br> | ||
− | '''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 extra parameters: username and siteid. | |
== Error Logging == | == Error Logging == | ||
− | If the reply is ERROR, NATS will add the error to the surfer's note so you | + | If the reply is "ERROR", NATS will add the error to the surfer's note so you |
− | can see the problem the Members Admin. | + | can see the problem in the Members Admin. |
− | |||
== Sample Script == | == Sample Script == |
Revision as of 13:07, 21 July 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.
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 in NATS will trigger your user management script.
ADD
Sent when a new username should be added to the user management system. This sends the following extra parameters: memberid, username, password, email, siteid, biller, and trial.
MANUALADD
Sent when a username is manually added via the members admin or through a biller refresh. This sends the following extra parameters: memberid, username, password, siteid, biller, and trial.
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 following extra parameters: memberid, username, password, siteid, biller, and trial.
TRIALTOFULL
Sent when a user changes from trial to full membership. This sends the following extra parameters: memberid, username, siteid, and biller.
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 sends the following extra parameters: memberid, username, siteid, biller, new_username, and new_password.
DELETE
Sent when a user's account should be immediately removed from the active user list. This sends the following extra parameters: memberid, username, siteid, and biller.
EXPIRE
Sent when a user's account should be expired on the provided date. The date might be in the past. This sends the following extra parameters: memberid, username, siteid, biller, and expire (expressed in YYYY-MM-DD format).
CHECK
Sent to check if a username is available.
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 extra 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() { }