Reports::forceOwnReportResults( $params )

Only allow non admin/mod to view his own reports

Description

Source

File: bp-integrations/learndash/buddypress/Reports.php

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
public function forceOwnReportResults($params)
{
    if (! $currentGroup = groups_get_current_group()) {
        return $params;
    }
 
    $userId = bp_loggedin_user_id();
    $groupId = $currentGroup->id;
 
    if (groups_is_user_admin($userId, $groupId) || groups_is_user_mod($userId, $groupId) || is_user_admin() ) {
        return $params;
    }
 
    $params['user_ids'] = [bp_loggedin_user_id()];
    return $params;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.