ActivityModel::getForRole PHP Method

getForRole() public method

Events: AfterGet.
Since: 2.0.18
public getForRole ( string $RoleID = '', integer $Offset, integer $Limit = 50 ) : Gdn_DataSet
$RoleID string Unique ID of role.
$Offset integer Number to skip.
$Limit integer Max number to return.
return Gdn_DataSet SQL results.
    public function getForRole($RoleID = '', $Offset = 0, $Limit = 50)
    {
        if (!is_array($RoleID)) {
            $RoleID = [$RoleID];
        }
        $Offset = is_numeric($Offset) ? $Offset : 0;
        if ($Offset < 0) {
            $Offset = 0;
        }
        $Limit = is_numeric($Limit) ? $Limit : 0;
        if ($Limit < 0) {
            $Limit = 0;
        }
        $this->activityQuery();
        $Result = $this->SQL->join('UserRole ur', 'a.ActivityUserID = ur.UserID')->whereIn('ur.RoleID', $RoleID)->where('t.Public', '1')->orderBy('a.DateInserted', 'desc')->limit($Limit, $Offset)->get();
        $this->EventArguments['Data'] =& $Result;
        $this->fireEvent('AfterGet');
        return $Result;
    }