Skip to content

Commit 6e8606f

Browse files
authored
Merge pull request #1810 from Rabbittoly/fix/critical-bugs-issues-1783-1701-1651-1728
Fix/critical bugs issues 1783 1701 1651 1728
2 parents fca35c4 + 9928cc9 commit 6e8606f

File tree

3 files changed

+40
-42
lines changed

3 files changed

+40
-42
lines changed

classes/class-log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function log( $connector, $message, $args, $object_id, $context, $action,
9797
}
9898

9999
$user_meta['system_user_id'] = (int) $uid;
100-
$user_meta['system_user_name'] = (string) $user_info['name'];
100+
$user_meta['system_user_name'] = is_array( $user_info ) ? (string) $user_info['name'] : '';
101101
}
102102

103103
// Prevent any meta with null values from being logged.

connectors/class-connector-buddypress.php

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ public function get_context_labels() {
175175
public function action_links( $links, $record ) {
176176

177177
// Check we have access to BuddyPress on this blog and that the user will have access to the links.
178-
if ( ! $this->is_dependency_satisfied() || ! bp_current_user_can_moderate() ) {
178+
if ( ! $this->is_dependency_satisfied() ) {
179+
return array();
180+
}
181+
182+
// Check if user has moderation capabilities (use function_exists to avoid fatal errors).
183+
if ( function_exists( 'bp_current_user_can' ) && ! bp_current_user_can( 'bp_moderate' ) ) {
179184
return array();
180185
}
181186

@@ -591,16 +596,14 @@ public function callback_bp_activity_deleted_activities( $activities_ids ) {
591596
if ( 1 === count( $activities_ids ) && isset( $this->deleted_activity ) ) { // Single activity deletion.
592597
$activity = $this->deleted_activity;
593598
$this->log(
594-
sprintf(
595-
/* translators: %s: an activity title (e.g. "Update") */
596-
__( '"%s" activity deleted', 'stream' ),
597-
wp_strip_all_tags( $activity->action )
598-
),
599+
/* translators: %s: an activity title (e.g. "Update") */
600+
__( '"%s" activity deleted', 'stream' ),
599601
array(
600-
'id' => $activity->id,
601-
'item_id' => $activity->item_id,
602-
'type' => $activity->type,
603-
'author' => $activity->user_id,
602+
'activity_action' => wp_strip_all_tags( $activity->action ),
603+
'id' => $activity->id,
604+
'item_id' => $activity->item_id,
605+
'type' => $activity->type,
606+
'author' => $activity->user_id,
604607
),
605608
$activity->id,
606609
$activity->component,
@@ -618,11 +621,8 @@ public function callback_bp_activity_deleted_activities( $activities_ids ) {
618621
return;
619622
}
620623
$this->log(
621-
sprintf(
622-
/* translators: %s: an activity title (e.g. "Update") */
623-
__( '"%s" activities were deleted', 'stream' ),
624-
count( $activities_ids )
625-
),
624+
/* translators: %s: number of activities */
625+
__( '%s activities were deleted', 'stream' ),
626626
array(
627627
'count' => count( $activities_ids ),
628628
'args' => $this->delete_activity_args,
@@ -647,16 +647,14 @@ public function callback_bp_activity_mark_as_spam( $activity, $by ) {
647647
unset( $by );
648648

649649
$this->log(
650-
sprintf(
651-
/* translators: %s an activity title (e.g. "Update") */
652-
__( 'Marked activity "%s" as spam', 'stream' ),
653-
wp_strip_all_tags( $activity->action )
654-
),
650+
/* translators: %s: an activity title (e.g. "Update") */
651+
__( 'Marked activity "%s" as spam', 'stream' ),
655652
array(
656-
'id' => $activity->id,
657-
'item_id' => $activity->item_id,
658-
'type' => $activity->type,
659-
'author' => $activity->user_id,
653+
'activity_action' => wp_strip_all_tags( $activity->action ),
654+
'id' => $activity->id,
655+
'item_id' => $activity->item_id,
656+
'type' => $activity->type,
657+
'author' => $activity->user_id,
660658
),
661659
$activity->id,
662660
$activity->component,
@@ -676,16 +674,14 @@ public function callback_bp_activity_mark_as_ham( $activity, $by ) {
676674
unset( $by );
677675

678676
$this->log(
679-
sprintf(
680-
/* translators: %s: an activity title (e.g. "Update") */
681-
__( 'Unmarked activity "%s" as spam', 'stream' ),
682-
wp_strip_all_tags( $activity->action )
683-
),
677+
/* translators: %s: an activity title (e.g. "Update") */
678+
__( 'Unmarked activity "%s" as spam', 'stream' ),
684679
array(
685-
'id' => $activity->id,
686-
'item_id' => $activity->item_id,
687-
'type' => $activity->type,
688-
'author' => $activity->user_id,
680+
'activity_action' => wp_strip_all_tags( $activity->action ),
681+
'id' => $activity->id,
682+
'item_id' => $activity->item_id,
683+
'type' => $activity->type,
684+
'author' => $activity->user_id,
689685
),
690686
$activity->id,
691687
$activity->component,
@@ -705,13 +701,11 @@ public function callback_bp_activity_admin_edit_after( $activity, $error ) {
705701
unset( $error );
706702

707703
$this->log(
708-
sprintf(
709-
/* translators: %s: an activity title (e.g. "Update") */
710-
__( '"%s" activity updated', 'stream' ),
711-
wp_strip_all_tags( $activity->action )
712-
),
704+
/* translators: %s: an activity title (e.g. "Update") */
705+
__( '"%s" activity updated', 'stream' ),
713706
array(
714-
'id' => $activity->id,
707+
'activity_action' => wp_strip_all_tags( $activity->action ),
708+
'id' => $activity->id,
715709
'item_id' => $activity->item_id,
716710
'type' => $activity->type,
717711
'author' => $activity->user_id,

connectors/class-connector-widgets.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,12 @@ public function callback_updated_option( $option_name, $old_value, $new_value )
549549
if ( $is_multi ) {
550550
$widget_id_format = "$widget_id_base-%d";
551551

552-
unset( $new_value['_multiwidget'] );
553-
unset( $old_value['_multiwidget'] );
552+
if ( is_array( $new_value ) && isset( $new_value['_multiwidget'] ) ) {
553+
unset( $new_value['_multiwidget'] );
554+
}
555+
if ( is_array( $old_value ) && isset( $old_value['_multiwidget'] ) ) {
556+
unset( $old_value['_multiwidget'] );
557+
}
554558

555559
/**
556560
* Created widgets

0 commit comments

Comments
 (0)