Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/class-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function log( $connector, $message, $args, $object_id, $context, $action,
$user_info = posix_getpwuid( $uid );

$user_meta['system_user_id'] = (int) $uid;
$user_meta['system_user_name'] = (string) $user_info['name'];
$user_meta['system_user_name'] = is_array( $user_info ) ? (string) $user_info['name'] : '';
}

// Prevent any meta with null values from being logged.
Expand Down
72 changes: 33 additions & 39 deletions connectors/class-connector-buddypress.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ public function get_context_labels() {
public function action_links( $links, $record ) {

// Check we have access to BuddyPress on this blog and that the user will have access to the links.
if ( ! $this->is_dependency_satisfied() || ! bp_current_user_can_moderate() ) {
if ( ! $this->is_dependency_satisfied() ) {
return array();
}

// Check if user has moderation capabilities (use function_exists to avoid fatal errors).
if ( function_exists( 'bp_current_user_can' ) && ! bp_current_user_can( 'bp_moderate' ) ) {
return array();
}

Expand Down Expand Up @@ -591,16 +596,14 @@ public function callback_bp_activity_deleted_activities( $activities_ids ) {
if ( 1 === count( $activities_ids ) && isset( $this->deleted_activity ) ) { // Single activity deletion.
$activity = $this->deleted_activity;
$this->log(
sprintf(
/* translators: %s: an activity title (e.g. "Update") */
__( '"%s" activity deleted', 'stream' ),
wp_strip_all_tags( $activity->action )
),
/* translators: %s: an activity title (e.g. "Update") */
__( '"%s" activity deleted', 'stream' ),
array(
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
'activity_action' => wp_strip_all_tags( $activity->action ),
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
),
$activity->id,
$activity->component,
Expand All @@ -618,11 +621,8 @@ public function callback_bp_activity_deleted_activities( $activities_ids ) {
return;
}
$this->log(
sprintf(
/* translators: %s: an activity title (e.g. "Update") */
__( '"%s" activities were deleted', 'stream' ),
count( $activities_ids )
),
/* translators: %s: number of activities */
__( '%s activities were deleted', 'stream' ),
array(
'count' => count( $activities_ids ),
'args' => $this->delete_activity_args,
Expand All @@ -647,16 +647,14 @@ public function callback_bp_activity_mark_as_spam( $activity, $by ) {
unset( $by );

$this->log(
sprintf(
/* translators: %s an activity title (e.g. "Update") */
__( 'Marked activity "%s" as spam', 'stream' ),
wp_strip_all_tags( $activity->action )
),
/* translators: %s: an activity title (e.g. "Update") */
__( 'Marked activity "%s" as spam', 'stream' ),
array(
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
'activity_action' => wp_strip_all_tags( $activity->action ),
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
),
$activity->id,
$activity->component,
Expand All @@ -676,16 +674,14 @@ public function callback_bp_activity_mark_as_ham( $activity, $by ) {
unset( $by );

$this->log(
sprintf(
/* translators: %s: an activity title (e.g. "Update") */
__( 'Unmarked activity "%s" as spam', 'stream' ),
wp_strip_all_tags( $activity->action )
),
/* translators: %s: an activity title (e.g. "Update") */
__( 'Unmarked activity "%s" as spam', 'stream' ),
array(
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
'activity_action' => wp_strip_all_tags( $activity->action ),
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
),
$activity->id,
$activity->component,
Expand All @@ -705,13 +701,11 @@ public function callback_bp_activity_admin_edit_after( $activity, $error ) {
unset( $error );

$this->log(
sprintf(
/* translators: %s: an activity title (e.g. "Update") */
__( '"%s" activity updated', 'stream' ),
wp_strip_all_tags( $activity->action )
),
/* translators: %s: an activity title (e.g. "Update") */
__( '"%s" activity updated', 'stream' ),
array(
'id' => $activity->id,
'activity_action' => wp_strip_all_tags( $activity->action ),
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
Expand Down
8 changes: 6 additions & 2 deletions connectors/class-connector-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,12 @@ public function callback_updated_option( $option_name, $old_value, $new_value )
if ( $is_multi ) {
$widget_id_format = "$widget_id_base-%d";

unset( $new_value['_multiwidget'] );
unset( $old_value['_multiwidget'] );
if ( is_array( $new_value ) && isset( $new_value['_multiwidget'] ) ) {
unset( $new_value['_multiwidget'] );
}
if ( is_array( $old_value ) && isset( $old_value['_multiwidget'] ) ) {
unset( $old_value['_multiwidget'] );
}

/**
* Created widgets
Expand Down