mpp_incremental_log( $args, $by =1 )
Save log info to database, If the log exist, do not save, just update the value by the given $by.
This function is mainly intended for the purpose where you want to increment value on multiple same actions.
$args (Array) (Required)
- 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 )
$by (int) (Optional)
How much to increment by.
The code shows how we log when a user views the Media( It is not part of core ). The value is incremented each time a user views the media.
'user_id' => get_current_user_id(),
'item_id' => 3,
'action' => 'view'
- Since 1.0.0