Welcome Tour
Site Checklist
Our Story




The mbase command is the big brother of the mbase function. That is, it include all the capabilities of the function, plus more.

Basically this command allows you to tap into the mbase membership system in various ways. You first need to set a "mode" (parameter #1) so it knows what you want to do. And then you need to set the id, field, and value parameters as needed depending on the mode.

Here's a brief list of the core capabilities of the mbase function. Review that section for the security precautions in place to protect your data when using these modes. Basically users have access to their own data, and no one else--unless they have admin capabilities.

exists: returns true or false depending on whether the account for "id" exists (ie, has an email on file).
get: return the value of the "field" parameter for the specified "id", or by default the current user.
list: returns all the ids as a csv list with the specified "value" for the indicated "field". Can be used to pull up all the ids who live in a specific country or state, for example.
find: returns the id of the account with the specified "value" for the indicated "field". Unlike list, only the first matching id will be returned.
check: indicates whether or not the current user is able to view a certain field. Returns true or false. A different id cannot be specified.
count: returns the total number of accounts (with an email on file). This is the only mode available to viewers who are not logged in.
fields: returns a list of all the available fields in your system. This mode is only available to site admins.

The command version of mbase adds three additional modes:

set: saves the specified "value" for the "field" parameter for the "id" indicated, or by default the current user.
delete: allows an admin to delete the entire account for a specified "id". All entries for all fields will be erased.
save: saves the values for the specified fields (fields parameter, or #2) for the indicated "id".

Several additional security features are built into these modes. First, if the user is not logged in, the function will do nothing. (The count mode is an exception via the mbase function).

When setting an mbase value, several restrictions apply if you are not an admin: You cannot set a field to a null value. You cannot save a value to another account. And you cannot set a value to an mbase field that does not already exist. Admins can however, set null values, save data to other accounts, and can create new fields using the set mode.

The save mode is similar, except it allows you to specify a csv list of fields ("fields" parameter or #2), and BoltWire will attempt to retrieve those field values from your form submission and save them each to the appropriate id. As usual, if you are not an admin, you cannot save a null value, save data to another members account, or save a field that does not already exist. Admin's can all three.

As for the delete mode, only admins can delete an account. But to prevent an accident, they are not able to delete their own account. No backup is saved, and there is no way to restore a deleted account, so use mode carefully.

And one last difference between the mbase command and function is that you can set the id to an email address and it will look up the appropriate id if it exists.