We have moved to Github. Please open tickets there.

Opened 4 years ago

Closed 3 years ago

#1370 closed Defect (fixed)

get_objects_in_group doesn't get objects by owner

Reported by: Drexel Owned by:
Priority: high Milestone: Elgg 1.7
Component: Core Version: 1.6
Severity: major Keywords:
Cc: brettp Difficulty:

Description

If the owner_guid parameter is set this function doesn't return any object as the owner_guid is used as container_guid in the sql statement. So you have container_guid = group_guid AND container_guid = owner_guid which cant't return any result.

In file engine\lib\group.php

if ($owner_guid != "") {

if (!is_array($owner_guid)) {

$owner_guid = (int) $owner_guid;
$where[] = "e.container_guid = '$owner_guid'";

} else if (sizeof($owner_guid) > 0) {

Cast every element to the owner_guid array to int
$owner_guid = array_map("sanitise_int", $owner_guid);
$owner_guid = implode(",",$owner_guid);
$where[] = "e.container_guid in ({$owner_guid})";

}

}

should be

if ($owner_guid != "") {

if (!is_array($owner_guid)) {

$owner_guid = (int) $owner_guid;
$where[] = "e.owner_guid = '$owner_guid'";

} else if (sizeof($owner_guid) > 0) {

Cast every element to the owner_guid array to int
$owner_guid = array_map("sanitise_int", $owner_guid);
$owner_guid = implode(",",$owner_guid);
$where[] = "e.owner_guid in ({$owner_guid})";

}

}

I guess (line no. 507-517).

Change History (2)

comment:1 Changed 3 years ago by cash

related to #1182

comment:2 Changed 3 years ago by brettp

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in 1.7's APIs.

Note: See TracTickets for help on using tickets.