Widget Developer Documentation

User Management

Moboom allows you to create and manage a user table. You can use this feature to build authentication features into your site for access control.

The API functions described below do not manage the internal Moboom user table. You cannot add new users to the Moboom platform this way. The user table discussed herein is entirely separate and distinct from platform users.

Adding new users

To register new users, call Moboom::userRegister(). Pass in the new username and password, and a few other parameters discussed below:

$properties = array();
Moboom::userRegister( $username, $password, $properties, $successUrl, $failureUrl);

The $properties parameter allows you to attach name–value pairs to a user record in the table. This feature is discussed below.

The last two parameters — $successUrl and $failureUrl — perform redirects based on the outcome of the action.

The registration operation is asynchronous, so you do not have the ability to respond immediately from within the widget code.

If the new registration is successful, the user is automatically logged in as part of this API call.


There are several API calls that are useful after a user is in the system. The following code illustrates them in a batch:

// logging in, logging out
Moboom::userLogin( $username, $password, $successUrl, $failureUrl);
Moboom::userLogout( $redirectUrl);

// password management
Moboom::userChangePassword( $oldPassword, $newPassword, $successUrl, $failureUrl);

// checking for an active user session
$currentUser = Moboom::getUsername();
if ( strlen( $currentUser) > 0) {}

Most of these APIs are self-explanatory. Note the use of Moboom::getUsername(). This is the correct way to test for an active user session.

Custom properties

When you create a new user with Moboom::userRegister(), you can optionally attach additional properties (name–value pairs) to the user’s record in the table. You can also add or update those properties at a later time.

The following code snippets illustrate the APIs related to custom properties. This is not a single code block, but a collection of small pieces of usable code.

// adding properties at registration
$properties = array(
    'signupdate' => time(),
    'affiliate' => $_GET['affiliate']
Moboom::userRegister( $username, $password, $properties, $successUrl, $failureUrl);

// getting & setting properties after registration & login
$currentUser = Moboom::getUsername();
if ( strlen( $currentUser) > 0) {

    // getting an array of all properties
    $allUserProperties = Moboom::userGet();

    // getting a single, specific property
    $signupDate = Moboom::userGetProperty( 'signupdate');

    // setting several properties at once
    Moboom::userSet( $properties);

    // setting a single property
    Moboom::userSetProperty( 'signupdate', time());

Properties are extremely versatile. You can use them for:

  • Setting multiple levels of access control. Assign a property to each user with their level.
  • Setting time-limited access. Assign a date to each user, and test against it on every page view.
  • Linking to a record in a content set. Assign the ID of the associated record in the content to a user property, and/or assign the user ID to a custom field in a content set by using Moboom::updateContent().
  • Storing user preferences. Assign a property to indicate a user’s preferred start page, color scheme, or any other option you need.


Most API functions in the user-management suite operate asynchronously. That is why many of them have no return value which you can test against for code branching. Instead, these APIs provide at least one (and usually two) URLs which you can use to branch based on the result. Feel free to use query string variables in those URLs, and test them with $_GET[] on the other side.

The property-management APIs are also asynchronous, to a degree. If you set a property with Moboom::userSetProperty(), the new value may not be immediately available using Moboom::userGetProperty().