Set User Group Data
User Group Index |
User Group Config |
Get 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.
insert_group()
Inserts a new user group to the database.
Library and Requirements
Available via the standard library.
Function Parameters
insert_group(name, description, is_admin, custom_data)
Help
Name |
Data Type |
Required |
Default |
Description |
name |
string |
Yes |
FALSE |
Defines the name of the user group. |
description |
string |
No |
NULL |
Defines a short description of the user group. |
is_admin |
bool |
No |
FALSE |
Defines whether the user group has some form of admin privileges. |
custom_data |
array |
No |
FALSE |
Defines any custom data that is to be inserted into the user group table.
|
How it Works
The function runs an SQL INSERT statement to insert the data passed to the function into the user group table.
Return Values
Failure:FALSE | An error message will be set.
Success:int | id of user group | A status message will be set.
Example
$name = 'Group 101';
$description = 'Description of group 101';
$is_admin = FALSE;
$custom_data = array(
'custom_col_1' => 'custom_value_1',
'custom_col_2' => 'custom_value_2'
);
$this->flexi_auth->insert_group($name, $description, $is_admin, $custom_data);
update_group()
Updates a user group with any submitted data.
Library and Requirements
Available via the standard library.
Function Parameters
update_group(group_id, group_data)
Help
Name |
Data Type |
Required |
Default |
Description |
group_id |
int |
Yes |
FALSE |
Defines the id of the user group to be updated. |
group_data |
array |
Yes |
FALSE |
Defines the columns and data within the user group table to be updated.
|
How it Works
The function loops through the 'group_data' argument and runs an SQL UPDATE statement by matching the array data with the user group table columns.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Example
$group_id = 101;
$group_data = array(
'ugrp_name' => 'Example Group Name',
'ugrp_desc' => 'Description of Example Group'
);
$this->flexi_auth->update_group($group_id, $group_data);
delete_group()
Deletes a group from the user group table.
Library and Requirements
Available via the standard library.
Function Parameters
delete_group(sql_where)
Help
Name |
Data Type |
Required |
Default |
Description |
sql_where |
string | int | array |
No |
FALSE |
Set the SQL WHERE statement used to filter the database records to return.
Read the defining SQL documentation for further information.
If a number is passed, the function will interpret the value as a group id.
|
How it Works
The function generates an SQL WHERE statement from the passed 'sql_where' argument and deletes all matching user groups.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Examples
$sql_where = 101;
$this->flexi_auth->delete_group($sql_where);
$sql_where = array(...);
$this->flexi_auth->delete_group($sql_where);