OpenBroadcaster Documentation
models / users_model.php

UsersModel

Model

Manages users, registering new ones, returning and updating lists of user information, user settings, and forgotten passwords.

public  email_username_password ( email, username, password )

Email temporary username and password to email address.

Parameters
email
username
password
public  forgotpass_process ( email )

Start the forgotten pass process for the provided email.

Parameters
email
public  forgotpass_validate ( email )

Validate an email address used in the forgotten password form.

Parameters
email
Returns [is_valid, msg]
public  get_by_id ( id )

Get a user by ID.

Parameters
id
Returns user
public  group_delete ( id )

Delete a group.

Parameters
id
public  group_list ( hide_permissions = false )

Get all groups.

Parameters
hide_permissions By default this gets all of a groups associated permissions. Set to TRUE to hide these.
Returns groups
public  group_save ( data, id = null )

Save or insert a group.

Parameters
data
id Group ID. NULL by default when inserting a new group.
public  group_validate ( data, id = null )

Validate a group before updating.

Parameters
data
id Group ID. NULL by default when inserting a new group.
Returns [is_valid, msg]
public  newaccount_process ( data )

Create a new user account with the provided data, generating a random password and sending a confirmation email.

Parameters
data
public  newaccount_validate ( data )

Validate data (name, email, and username) provided for a new account.

Parameters
data
Returns [is_valid, msg]
public  permissions_list ( )

Get all users permissions as well as the ones linked to each player.

Returns permissions
public  randpass ( )

Generate a random password.

Returns password
public  settings_update ( user_id, data )

Update user settings.

Parameters
user_id
data
public  settings_validate ( user_id, data )

Validate user settings.

Parameters
user_id
data
Returns [is_valid, msg]
public  user_delete ( id )

Delete a user.

Parameters
id
public  user_list ( )

List all users' display names, IDs, and associated email addresses.

Returns users
public  user_manage_key_delete ( id, user_id )

Delete an App Key associated with a specified user.

Parameters
id
user_id
Returns is_deleted?
public  user_manage_key_load ( id )

Load all App Keys associated with a user.

Parameters
id
Returns appkeys
public  user_manage_key_new ( id )

Generate a new App Key for the provided user ID.

Parameters
id
Returns [id, name, key, created, last_access]
public  user_manage_key_permissions_save ( id, permissions, user_id )

Save App Key permisisons (will validate first).

Parameters
id
permissions
user_id
public  user_manage_key_permissions_validate ( id, permissions, user_id )

Validate App Key permisisons.

Parameters
id
permissions
user_id
public  user_manage_list ( sort_col = 'display_name', sort_dir = 'asc' )

Return a filtered list of users and their associated groups.

Parameters
sort_col Column to sort users by. 'display_name' by default.
sort_dir Direction to sort. 'asc' by default.
Returns users
public  user_manage_list_get_sort ( )

Get the user list sorting settings from the settings table.

Returns [sort_col, sort_dir]
public  user_manage_list_set_sort ( sort_col, sort_dir )

Update settings table with sorting settings for users list.

Parameters
sort_col Column to sort users list by.
sort_dir Direction to sort users list.
public  user_registration_get ( )

Return the user registration settings.

Returns can_register
public  user_registration_set ( value )

Set to TRUE or FALSE in the settings table depending on whether new users can be registered.

Parameters
value Boolean determing whether new users can register.
public  user_save ( data, id = null )

Udate or save a new user.

Parameters
data
id User ID. NULL by default if inserting a new user.
public  user_validate ( data, id = null )

Validate user fields before updating.

Parameters
data
id User ID. NULL by default if inserting a new user.
Returns [is_valid, msg]