{"id":105,"date":"2015-09-07T15:55:19","date_gmt":"2015-09-07T15:55:19","guid":{"rendered":"http:\/\/buddydev.com\/mediapress\/?p=105"},"modified":"2015-09-07T19:36:45","modified_gmt":"2015-09-07T19:36:45","slug":"mediapress-logging-api","status":"publish","type":"post","link":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/","title":{"rendered":"MediaPress Logging API"},"content":{"rendered":"<p>MediaPress provides an easy to use logging API to allow plugin developers log and manipulate various MediaPress actions\/events.<\/p>\n<h3>Table Schema:-<\/h3>\n<p>The table schema for the logging table is as shown below.<\/p>\n<p><a href=\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-106\" src=\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema-300x163.png\" alt=\"mpp-logs-table-schema\" width=\"300\" height=\"163\" srcset=\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema-300x163.png 300w, https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png 959w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The <strong>table is named as &#8216;yourprefix_mpp_logs&#8217;<\/strong> where yourprefix is the database prefix you are using. You can access the table name programatically using the following table<\/p>\n<pre class=\"lang:php decode:true \">\/\/get logs table name\r\n\/\/it is like dbprefix_mpp_logs where dbprefix is your database prefix\r\n$log_table = mediapress()-&gt;get_table_name( 'logs' );<\/pre>\n<div class='ui-sc ui-info-message'><p><\/p>\n<p>While logging, you should be careful to choose your action name and value field. Action name can not be longer than 16 characters and value can not be larger than 32 characters( In future, if we don&#8217;t see enough use case, we will convert value field to shortint or\u00a0int type).<\/p>\n<p><\/p><\/div>\n<p>PS: There is no database model class associated with this table. We have done it on purpose.<\/p>\n<h3>API Functions: &#8211;<\/h3>\n<ul>\n<li><a title=\"mpp_log function reference\" href=\"https:\/\/buddydev.com\/mediapress\/topics\/api-guides\/logger\/mpp_log\/\">mpp_log( $args )<\/a> :- Log an action<\/li>\n<li><a title=\"mpp_incremental_log() function reference\" href=\"https:\/\/buddydev.com\/mediapress\/topics\/api-guides\/logger\/mpp_incremental_log\/\">mpp_incremental_log( $args, $by = 1 )<\/a> : &#8211; Logs an action, if duplicate, then only increments the value by given number<\/li>\n<li><a title=\"mpp_delete_logs() function reference\" href=\"https:\/\/buddydev.com\/mediapress\/topics\/api-guides\/logger\/mpp_delete_logs\/\">mpp_delete_logs( $args )<\/a>:- Delete one or more log entry<\/li>\n<li><a title=\"mpp_log_exists() function reference\" href=\"https:\/\/buddydev.com\/mediapress\/topics\/api-guides\/logger\/mpp_log_exists\/\">mpp_log_exists( $args )<\/a>:- Check if a log exists for the given condition. Returns the database row as object if exists or null if not.<\/li>\n<li><a title=\"mpp_get_logs() function reference\" href=\"https:\/\/buddydev.com\/mediapress\/topics\/api-guides\/logger\/mpp_get_logs\/\">mpp_get_logs( $args )<\/a>:- Get an array of logs<\/li>\n<li>mpp_get_logger():- Get the logger object<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MediaPress provides an easy to use logging API to allow plugin developers log and manipulate various MediaPress actions\/events. Table Schema:- The table schema for the logging table is as shown below. &nbsp; The table is named as &#8216;yourprefix_mpp_logs&#8217; where yourprefix is the database prefix you are using. You can access the table name programatically using &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7044,7056],"tags":[],"class_list":["clearfix","post-105","post","type-post","status-publish","format-standard","hentry","category-api-guides","category-logger"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MediaPress Logging API &#8226; MediaPress | BuddyDev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MediaPress Logging API &#8226; MediaPress | BuddyDev\" \/>\n<meta property=\"og:description\" content=\"MediaPress provides an easy to use logging API to allow plugin developers log and manipulate various MediaPress actions\/events. Table Schema:- The table schema for the logging table is as shown below. &nbsp; The table is named as &#8216;yourprefix_mpp_logs&#8217; where yourprefix is the database prefix you are using. You can access the table name programatically using ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/\" \/>\n<meta property=\"og:site_name\" content=\"MediaPress | BuddyDev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/bpdev\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-07T15:55:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-09-07T19:36:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png\" \/>\n\t<meta property=\"og:image:width\" content=\"959\" \/>\n\t<meta property=\"og:image:height\" content=\"522\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Brajesh Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sbrajesh\" \/>\n<meta name=\"twitter:site\" content=\"@buddydev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brajesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/\",\"url\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/\",\"name\":\"MediaPress Logging API &#8226; MediaPress | BuddyDev\",\"isPartOf\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema-300x163.png\",\"datePublished\":\"2015-09-07T15:55:19+00:00\",\"dateModified\":\"2015-09-07T19:36:45+00:00\",\"author\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\"},\"breadcrumb\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage\",\"url\":\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png\",\"contentUrl\":\"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png\",\"width\":959,\"height\":522},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/buddydev.com\/mediapress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MediaPress Logging API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\",\"url\":\"https:\/\/buddydev.com\/mediapress\/\",\"name\":\"MediaPress | BuddyDev\",\"description\":\"The Best Media Gallery Plugin For BuddyPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\",\"name\":\"Brajesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"contentUrl\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"caption\":\"Brajesh Singh\"},\"sameAs\":[\"http:\/\/buddydev.com\/members\/sbrajesh\/\",\"https:\/\/x.com\/sbrajesh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MediaPress Logging API &#8226; MediaPress | BuddyDev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/","og_locale":"en_US","og_type":"article","og_title":"MediaPress Logging API &#8226; MediaPress | BuddyDev","og_description":"MediaPress provides an easy to use logging API to allow plugin developers log and manipulate various MediaPress actions\/events. Table Schema:- The table schema for the logging table is as shown below. &nbsp; The table is named as &#8216;yourprefix_mpp_logs&#8217; where yourprefix is the database prefix you are using. You can access the table name programatically using ...","og_url":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/","og_site_name":"MediaPress | BuddyDev","article_publisher":"https:\/\/www.facebook.com\/bpdev","article_published_time":"2015-09-07T15:55:19+00:00","article_modified_time":"2015-09-07T19:36:45+00:00","og_image":[{"width":959,"height":522,"url":"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png","type":"image\/png"}],"author":"Brajesh Singh","twitter_card":"summary_large_image","twitter_creator":"@sbrajesh","twitter_site":"@buddydev","twitter_misc":{"Written by":"Brajesh Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/","url":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/","name":"MediaPress Logging API &#8226; MediaPress | BuddyDev","isPartOf":{"@id":"https:\/\/buddydev.com\/mediapress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage"},"image":{"@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage"},"thumbnailUrl":"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema-300x163.png","datePublished":"2015-09-07T15:55:19+00:00","dateModified":"2015-09-07T19:36:45+00:00","author":{"@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb"},"breadcrumb":{"@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#primaryimage","url":"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png","contentUrl":"https:\/\/buddydev.com\/mediapress\/files\/2015\/09\/mpp-logs-table-schema.png","width":959,"height":522},{"@type":"BreadcrumbList","@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/mediapress-logging-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/buddydev.com\/mediapress\/"},{"@type":"ListItem","position":2,"name":"MediaPress Logging API"}]},{"@type":"WebSite","@id":"https:\/\/buddydev.com\/mediapress\/#website","url":"https:\/\/buddydev.com\/mediapress\/","name":"MediaPress | BuddyDev","description":"The Best Media Gallery Plugin For BuddyPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb","name":"Brajesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/","url":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","contentUrl":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","caption":"Brajesh Singh"},"sameAs":["http:\/\/buddydev.com\/members\/sbrajesh\/","https:\/\/x.com\/sbrajesh"]}]}},"_links":{"self":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":4,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/105\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}