User Guide | Getting User Group Data

The flexi auth library functions for getting data from the user group table.

Get User Group Data

User Group Index | User Group Config | Set User Group Data

Help with Function Parameters

Show / Hide Help

Name: The name of the function parameter (argument).

Data Type: The data type that is expected by the parameter.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

get_groups()

Gets a list of user groups filtered by a custom SQL WHERE statement.


Library and Requirements

Available via the standard library.

Function Parameters
get_groups(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | array No FALSE Set the SQL WHERE statement used to filter the database records to return.
Read the defining SQL documentation for further information.
How it Works

The function uses the defined 'sql_where' argument to create an SQL WHERE statement to filter a list of user groups from the user group table.

The data returned by the query is defined via the 'sql_select' argument. If no columns are specified, all columns will be returned.

Notes

This function is compatible with flexi auths 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi auth and CodeIgniter functions that are available.

Return Values

Failure:FALSE

Success:object

Examples
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_auth->get_groups($sql_select, $sql_where)->result();

get_users_group()

Gets records from the user group table typically for a filtered set of users.


Library and Requirements

Available via the standard library.

Function Parameters
get_users_group(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | array No FALSE Set the SQL WHERE statement used to filter the database records to return.
Read the defining SQL documentation for further information.
How it Works

By default the function is set to return all columns from the user group table for all filtered users.
However, by defining specific user table columns via the 'sql_select' argument, it is possible to return other user data.

Notes

This function is compatible with flexi auths 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi auth and CodeIgniter functions that are available.

Return Values

Failure:FALSE

Success:object

Example
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_auth->get_users_group($sql_select, $sql_where)->result();

get_user_group_id()

Get the users group id from the session.


Library and Requirements

Available via the lite and standard libraries.

How it Works

The function get the user group id value saved in the users browser session.

Return Values

Failure:FALSE

Success:int

Example
Note: The returned example values below are displaying live data from the current auth database and session data set via the demo set via the demo.
get_user_group_id() What is the user group id of the current logged in user? NULL

get_user_group()

Get the users user group name from the session.


Library and Requirements

Available via the lite and standard libraries.

How it Works

The function get the user group name saved in the users browser session.

Return Values

Failure:FALSE

Success:string

Example
Note: The returned example values below are displaying live data from the current auth database and session data set via the demo.
get_user_group() What is the user group name of the current logged in user? NULL