mpp_log( $args )
Save log info to database.
Description
This function allows developers to save log data to the database.
Parameters
$args
- user_id (int) (Required) the user for which we are creating this log
- item_id (int) (Required) gallery or media id to which we associate this action
- action (string) (required, max 16 characters) Unique name to identify action ( e.g. ”view”, “like” etc)
- value ( int|string) ( optional ) any value you want to associate with this action log ( e.g. view count or like count or rating value etc )
Examples
The code shows how we log when a user views the Media( It is not part of core )
1 2 3 4 5 6 | mpp_log( array( 'user_id' => get_current_user_id(), 'item_id' => 3, 'action' => 'view', 'value' => 1 ) ); |
Changelog
- Since 1.0.0
Source
medisapress/core/logger/functions.php