User Guide | Message Functions

The flexi auth library functions for displaying status and error messages to users after they have performed an action using a library function.

Status and Error Messages

Message Index | Message Config

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.

status_messages()

Get any status message(s) that may have been set by recently run functions.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
status_messages(target_user, prefix_delimiter, suffix_delimiter) Help
Name Data Type Required Default Description
target_user string No public Define whether to suppress any 'admin' error messages and only return 'public' messages intended for notifying public users.
Defining 'public' will return the message for both public and admin users.
Defining 'admin' will return the message for admin users only.
prefix_delimiter string No FALSE Define a string of characters to prefix to the status message.
Typically this is intended to allow elements to be wrapped around messages.
If no prefix is set, the 'status_prefix_delimiter' defined via the config. file is used instead.
suffix_delimiter string No FALSE Define a string of characters to suffix to the status message.
Typically this is intended to allow elements to be wrapped around messages.
If no suffix is set, the 'status_suffix_delimiter' defined via the config. file is used instead.
Notes

The messages returned by flexi cart functions can be returned in other languages by defining the translation in CodeIgniters language directory.

To define your own translations, create a folder within the CI language directory named as the language, e.g. 'french'.
Then copy the 'flexi_cart_lang.php' file from the 'english' folder to the new language folder and translate the messages within the file.

For further information, read the CodeIgniter documentation on the language library.

Return Values

Failure:FALSE

Success:string

Examples
status_messages('admin', FALSE, FALSE) This would return all admin status messages as non formatted text.
status_messages('public', FALSE, FALSE) This would return all public and admin status messages as non formatted text.
status_messages('admin', '<p>', '</p>') This would return all admin status messages formatted in a html <p> tag.

set_status_message()

Set a status message to be displayed to the user.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
set_status_message(status_message, target_user, overwrite_existing) Help
Name Data Type Required Default Description
status_message string Yes FALSE Defines the status message to be set.
target_user string No public Define whether to set the message as a 'public' or 'admin' status message.
overwrite_existing bool No FALSE Define whether to overwrite any existing status messages.
Return Values

Failure:n/a

Success:'status_message' parameter value

Examples
set_status_message('This is a custom ADMIN status message', 'admin', FALSE) This would set a status message that would NOT be shown in public areas of the site.
set_status_message('This is a custom PUBLIC status message', 'public', FALSE) This would set a status message that would be shown in public and admin areas of the site.
set_status_message('This is a custom PUBLIC status message', 'public', TRUE) This would overwrite any existing messages and then set a status message that would be shown in public and admin areas of the site.

clear_status_messages()

Clear all status messages.


Library and Requirements

Available via the lite and standard libraries.

Return Values

Failure:n/a

Success:TRUE

Examples
clear_status_messages() This would remove all currently set status messages.

error_messages()

Get any error message(s) that may have been set by recently run functions.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
error_messages(target_user, prefix_delimiter, suffix_delimiter) Help
Name Data Type Required Default Description
target_user string No public Define whether to suppress any 'admin' error messages and only return 'public' messages intended for notifying public users.
Defining 'public' will return the message for both public and admin users.
Defining 'admin' will return the message for admin users only.
prefix_delimiter string No FALSE Define a string of characters to prefix to the error message.
Typically this is intended to allow elements to be wrapped around messages.
If no prefix is set, the 'error_prefix_delimiter' defined via the config. file is used instead.
suffix_delimiter string No FALSE Define a string of characters to suffix to the error message.
Typically this is intended to allow elements to be wrapped around messages.
If no suffix is set, the 'error_suffix_delimiter' defined via the config. file is used instead.
Notes

The messages returned by flexi cart functions can be returned in other languages by defining the translation in CodeIgniters language directory.

To define your own translations, create a folder within the CI language directory named as the language, e.g. 'french'.
Then copy the 'flexi_cart_lang.php' file from the 'english' folder to the new language folder and translate the messages within the file.

For further information, read the CodeIgniter documentation on the language library.

Return Values

Failure:FALSE

Success:string

Examples
error_messages('admin', FALSE, FALSE) This would return all admin error messages as non formatted text.
error_messages('public', FALSE, FALSE) This would return all public and admin error messages as non formatted text.
error_messages('admin', '<p>', '</p>') This would return all admin error messages formatted in a html <p> tag.

set_error_message()

Set an error message to be displayed to the user.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
set_error_message(error_message, target_user, overwrite_existing) Help
Name Data Type Required Default Description
error_message string Yes FALSE Defines the error message to be set.
target_user string No public Define whether to set the message as a 'public' or 'admin' error message.
overwrite_existing bool No FALSE Define whether to overwrite any existing error messages.
Return Values

Failure:n/a

Success:'error_message' parameter value

Examples
set_error_message('This is a custom ADMIN error message', 'admin', FALSE) This would set an error message that would NOT be shown in public areas of the site.
set_error_message('This is a custom PUBLIC error message', 'public', FALSE) This would set an error message that would be shown in public and admin areas of the site.
set_error_message('This is a custom PUBLIC error message', 'public', TRUE) This would overwrite any existing messages and then set a error message that would be shown in public and admin areas of the site.

clear_error_messages()

Clear all error messages.


Library and Requirements

Available via the lite and standard libraries.

Return Values

Failure:n/a

Success:TRUE

Examples
clear_error_messages() This would remove all currently set error messages.

clear_messages()

Clear all status and error messages.


Library and Requirements

Available via the lite and standard libraries.

Return Values

Failure:n/a

Success:TRUE

Examples
clear_messages() This would remove all currently set status and error messages.

get_messages_array()

Returns any set messages, grouped into a 'status' and 'error' array.
The returned status and error messages are then further grouped into 'public' and 'admin' type messages.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
get_messages_array(target_user, prefix_delimiter, suffix_delimiter) Help
Name Data Type Required Default Description
target_user string No public Define whether to suppress any 'admin' error messages and only return 'public' messages intended for notifying public users.
Defining 'public' will return the message for both public and admin users.
Defining 'admin' will return the message for admin users only.
prefix_delimiter string No FALSE Define a string of characters to prefix to the messages.
Typically this is intended to allow elements to be wrapped around messages.
If no prefix is set, the corresponding 'status_prefix_delimiter' and 'error_prefix_delimiter' defined via the config. file is used instead.
suffix_delimiter string No FALSE Define a string of characters to suffix to the messages.
Typically this is intended to allow elements to be wrapped around messages.
If no suffix is set, the corresponding 'status_suffix_delimiter' and 'error_suffix_delimiter' defined via the config. file is used instead.
Notes

The messages returned by flexi cart functions can be returned in other languages by defining the translation in CodeIgniters language directory.

To define your own translations, create a folder within the CI language directory named as the language, e.g. 'french'.
Then copy the 'flexi_cart_lang.php' file from the 'english' folder to the new language folder and translate the messages within the file.

For further information, read the CodeIgniter documentation on the language library.

Return Values

Failure:FALSE

Success:array

Examples
get_messages_array('admin', FALSE, FALSE) This would return an array of all the admin status and error messages as non formatted text, with an array key indicating the message type.
get_messages_array('public', FALSE, FALSE) This would return an array of all the public and admin status and error messages as non formatted text, with an array key indicating the message type.
get_messages_array('admin', '<p>', '</p>') This would return an array of all the admin status and error messages formatted in a html <p> tag, with an array key indicating the message type.

get_messages()

Get any operational function messages whether of status or error type and format their output with delimiters.


Library and Requirements

Available via the lite and standard libraries.

Function Parameters
get_messages(target_user, prefix_delimiter, suffix_delimiter) Help
Name Data Type Required Default Description
target_user string No public Define whether to suppress any 'admin' error messages and only return 'public' messages intended for notifying public users.
Defining 'public' will return the message for both public and admin users.
Defining 'admin' will return the message for admin users only.
prefix_delimiter string No FALSE Define a string of characters to prefix to the messages.
Typically this is intended to allow elements to be wrapped around messages.
If no prefix is set, the corresponding 'status_prefix_delimiter' and 'error_prefix_delimiter' defined via the config. file is used instead.
suffix_delimiter string No FALSE Define a string of characters to suffix to the messages.
Typically this is intended to allow elements to be wrapped around messages.
If no suffix is set, the corresponding 'status_suffix_delimiter' and 'error_suffix_delimiter' defined via the config. file is used instead.
Notes

The messages returned by flexi cart functions can be returned in other languages by defining the translation in CodeIgniters language directory.

To define your own translations, create a folder within the CI language directory named as the language, e.g. 'french'.
Then copy the 'flexi_cart_lang.php' file from the 'english' folder to the new language folder and translate the messages within the file.

For further information, read the CodeIgniter documentation on the language library.

Return Values

Failure:FALSE

Success:string

Examples
get_messages('admin', FALSE, FALSE) This would return all admin status and error messages as non formatted text.
get_messages('public', FALSE, FALSE) This would return all public and admin status and error messages as non formatted text.
get_messages('admin', '<p>', '</p>') This would return all admin status and error messages formatted in a html <p> tag.