mpp_get_log( $args )
Get logs information.
Description
This function fetches one or more log records.
Parameters
$args
- user_id (int) (Optional) the user for which we are creating this log
- item_id (int) (Optional) gallery or media id to which we associate this action
- action (string) (Optional) action identifier ( e.g. ”view”, “like” etc)
- value ( int|string) ( Optional ) any specific value you want to look for ( e.g. view count or like count or rating value etc )
- per_page ( int) (Optional) How many per page
- page (int) (Optional ) Specify the page number for paged results
Returns
null|array Null if no record found otherwise an array of record objects.
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 7 | //get 10 latest views for the media id $logs = mpp_get_logs( array( 'per_page' => 10, 'page' => 1, 'action' => 'view', 'item_id' => 3, //media id ) ); |
Changelog
- Since 1.0.0
Source
medisapress/core/logger/functions.php