Used to log various activities performed by users on a website.
Location
users/helpers/us_helpers.php
Parameters
#
Parameter
Data Type
Required
Description
1
$user_id =
integer
No
The ID of the user performing the activity. If not provided, it will be set to the currently logged in user's ID. If no user is logged in, it will be set to 0.
2
$logtype =
string
Yes
A string representing the type of activity being logged. This can be any value, but it is recommended to use descriptive names for easier analysis later.
3
$lognote =
string, array, or object
Yes
A string or array/object that describes the activity in more detail. This can be used to provide additional context for the log entry.
4
$metadata = null
string, array, or object
No
An optional array or object containing additional data related to the activity being logged. This can be used to store any relevant data that might be useful for analysis later.
5
$user_id = ""
Yes
undocumented
6
$logtype = ""
Yes
undocumented
7
$lognote = ""
Yes
undocumented
Returns
Data Type
Description of Returned Data
nothing
Further Documentation:
The function then inserts the log entry into the logs table in the database and returns the ID of the newly created log entry.
Here's an example usage of the logger function:
logger($user->data()->id, 'login', 'User logged in successfully');
This will log a login activity for the currently logged in user with the message "User logged in successfully". The $user->data()->id parameter specifies the ID of the user performing the activity.