BuddyDev

Search

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.

Description

This function is mainly intended for the purpose where you want to increment value on multiple same actions.

Parameters

$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.

 Examples

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.

 

 Changelog

  • Since 1.0.0

Source

medisapress/core/logger/functions.php