Skip to:
Content

BuddyPress.org

Ticket #7023: patch1.patch

File patch1.patch, 1.2 KB (added by VibeThemes, 8 years ago)

check_access in BP_Notifications_Notification

  • src/bp-notifications/classes/class-bp-notifications-notification.php

    From b7033ed04a73c8690cf85e6f94377d743eb79447 Mon Sep 17 00:00:00 2001
    From: Ripul Kumar <vibethemes@gmail.com>
    Date: Mon, 18 Apr 2016 16:57:53 +0530
    Subject: [PATCH] check_access should allow access to administrators
    
    ---
     .../classes/class-bp-notifications-notification.php                | 7 +++++--
     1 file changed, 5 insertions(+), 2 deletions(-)
    
    diff --git a/src/bp-notifications/classes/class-bp-notifications-notification.php b/src/bp-notifications/classes/class-bp-notifications-notification.php
    index c417b89..9aa65ab 100644
    a b class BP_Notifications_Notification { 
    560560         *              false.
    561561         */
    562562        public static function check_access( $user_id, $notification_id ) {
    563                 global $wpdb;
    564563
    565                 $bp = buddypress();
     564                if(current_user_can( 'edit_user', $user_id ) || bp_current_user_can( 'bp_moderate' )){
     565                        return 1;
     566                }
    566567
     568                global $wpdb;
     569                $bp = buddypress();
    567570                return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
    568571        }
    569572