MainWP Child Reports - Version 1.9.3

Version Description

  • 2-14-2019 =
  • Fixed: an issue with catching Media upload records
  • Fixed: "Undefined variable: branding_header" PHP warning
Download this release

Release Info

Developer mainwp
Plugin Icon 128x128 MainWP Child Reports
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

Files changed (3) hide show
  1. connectors/media.php +41 -5
  2. mainwp-child-reports.php +3 -2
  3. readme.txt +5 -1
connectors/media.php CHANGED
@@ -4,7 +4,8 @@ class MainWP_WP_Stream_Connector_Media extends MainWP_WP_Stream_Connector {
4
 
5
  public static $name = 'media';
6
 
7
- public static $actions = array(
 
8
  'edit_attachment',
9
  'delete_attachment',
10
  'wp_save_image_editor_file',
@@ -16,10 +17,13 @@ class MainWP_WP_Stream_Connector_Media extends MainWP_WP_Stream_Connector {
16
  }
17
 
18
  public static function get_action_labels() {
19
- return array(
20
- 'uploaded' => __( 'Uploaded', 'mainwp-child-reports' ),
21
- 'updated' => __( 'Updated', 'mainwp-child-reports' ),
22
- 'deleted' => __( 'Deleted', 'mainwp-child-reports' )
 
 
 
23
  );
24
  }
25
 
@@ -67,6 +71,38 @@ class MainWP_WP_Stream_Connector_Media extends MainWP_WP_Stream_Connector {
67
  return $links;
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  public static function callback_edit_attachment( $post_id ) {
71
  $post = get_post( $post_id );
72
  $message = __( 'Updated "%s"', 'mainwp-child-reports' );
4
 
5
  public static $name = 'media';
6
 
7
+ public static $actions = array(
8
+ 'add_attachment',
9
  'edit_attachment',
10
  'delete_attachment',
11
  'wp_save_image_editor_file',
17
  }
18
 
19
  public static function get_action_labels() {
20
+ return array(
21
+ 'attached' => esc_html__( 'Attached', 'mainwp-child-reports' ),
22
+ 'uploaded' => esc_html__( 'Uploaded', 'mainwp-child-reports' ),
23
+ 'updated' => esc_html__( 'Updated', 'mainwp-child-reports' ),
24
+ 'deleted' => esc_html__( 'Deleted', 'mainwp-child-reports' ),
25
+ // 'assigned' => esc_html__( 'Assigned', 'mainwp-child-reports' ),
26
+ // 'unassigned' => esc_html__( 'Unassigned', 'mainwp-child-reports' ),
27
  );
28
  }
29
 
71
  return $links;
72
  }
73
 
74
+ public static function callback_add_attachment( $post_id ) {
75
+ $post = get_post( $post_id );
76
+ if ( $post->post_parent ) {
77
+ // translators: Placeholders refer to an attachment title, and a post title (e.g. "PIC001", "Hello World")
78
+ $message = _x(
79
+ 'Attached "%1$s" to "%2$s"',
80
+ '1: Attachment title, 2: Parent post title',
81
+ 'stream'
82
+ );
83
+ } else {
84
+ // translators: Placeholder refers to an attachment title (e.g. "PIC001")
85
+ $message = esc_html__( 'Added "%s" to Media library', 'stream' );
86
+ }
87
+
88
+ $name = $post->post_title;
89
+ $url = $post->guid;
90
+ $parent_id = $post->post_parent;
91
+ $parent = get_post( $parent_id );
92
+ $parent_title = $parent_id ? $parent->post_title : null;
93
+ $attachment_type = self::get_attachment_type( $post->guid );
94
+
95
+ self::log(
96
+ $message,
97
+ compact( 'name', 'parent_title', 'parent_id', 'url' ),
98
+ $post_id,
99
+ // $attachment_type,
100
+ // $post->post_parent ? 'attached' : 'uploaded'
101
+ array( $attachment_type => $post->post_parent ? 'attached' : 'uploaded' )
102
+ );
103
+ }
104
+
105
+
106
  public static function callback_edit_attachment( $post_id ) {
107
  $post = get_post( $post_id );
108
  $message = __( 'Updated "%s"', 'mainwp-child-reports' );
mainwp-child-reports.php CHANGED
@@ -5,7 +5,7 @@
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
- Version: 1.9.2
9
  */
10
 
11
  /**
@@ -123,7 +123,7 @@ class MainWP_WP_Stream {
123
  public function get_branding_options() {
124
  if ( $this->branding_options === null ) {
125
 
126
- $opts = get_option( 'mainwp_child_branding_options' ); // settings from mainwp-child plugin
127
  // this is new update
128
  if ( is_array($opts) ) {
129
  if (isset($opts['cancelled_branding'])) { // if it was set
@@ -141,6 +141,7 @@ class MainWP_WP_Stream {
141
  $opts['branding_header'] = get_option( 'mainwp_branding_plugin_header' );
142
  $cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
143
  $opts['cancelled_branding'] = $cancelled_branding;
 
144
  }
145
 
146
  if ( ! $cancelled_branding && ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) ) {
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
+ Version: 1.9.3
9
  */
10
 
11
  /**
123
  public function get_branding_options() {
124
  if ( $this->branding_options === null ) {
125
 
126
+ $opts = get_option( 'mainwp_child_branding_settings' ); // settings from mainwp-child plugin
127
  // this is new update
128
  if ( is_array($opts) ) {
129
  if (isset($opts['cancelled_branding'])) { // if it was set
141
  $opts['branding_header'] = get_option( 'mainwp_branding_plugin_header' );
142
  $cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
143
  $opts['cancelled_branding'] = $cancelled_branding;
144
+ $branding_header = $opts['branding_header'];
145
  }
146
 
147
  if ( ! $cancelled_branding && ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) ) {
readme.txt CHANGED
@@ -7,7 +7,7 @@ Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
  Tested up to: 5.0.3
10
- Stable tag: 1.9.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -36,6 +36,10 @@ Credit to the [Stream Plugin](https://wordpress.org/plugins/stream/) which the M
36
 
37
  == Changelog ==
38
 
 
 
 
 
39
  = 1.9.2 - 1-30-2019 =
40
  * Fixed: an issue with cleaning the plugin database tables on some setups
41
  * Updated: MySQL query improvements
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
  Tested up to: 5.0.3
10
+ Stable tag: 1.9.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.9.3 - 2-14-2019 =
40
+ * Fixed: an issue with catching Media upload records
41
+ * Fixed: "Undefined variable: branding_header" PHP warning
42
+
43
  = 1.9.2 - 1-30-2019 =
44
  * Fixed: an issue with cleaning the plugin database tables on some setups
45
  * Updated: MySQL query improvements