#2697 closed Defect (fixed)
cannot filter activity by user or group due to no subtype
| Reported by: | milan | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.7.7 |
| Component: | River Dashboard | Version: | 1.7 |
| Severity: | minor | Keywords: | |
| Cc: | brettp | Difficulty: | easy |
Description
In a previous version of Elgg (at least 1.6, not sure about 1.7 releases) I was able to filter by user and group in activity. In the current version I am using 1.7.5
I can't now as when user and groups are registered as entity types (i.e. register_entity_type('user', ) & register_entity_type('group', )) because they have no subtype the register_entity_type() function doesn't store an empty subtype as it previously did (which I think is kindof fair enough).
In the riverdashboard/nav view this will now cause the $keyname variable never to be set as there is nothing to be looped in the foreach i.e.
if (!empty($vars['config']->registered_entities)) {
foreach ($vars['config']->registered_entities as $type => $ar) {
// NEVER WILL GET INTO THE LOOP BELOW FOR USER AND GROUPS
foreach ($vars['config']->registered_entities[$type] as $object) {
if (!empty($object )) {
$keyname = 'item:' . $type . ':' . $object;
} else {
$keyname = 'item:' . $type;
}
$contents[$keyname] = "{$type},{$object}";
}
}
}
I propose this loop should be changed to allow types without subtypes to be allowed as a filter i.e.
if (!empty($vars['config']->registered_entities)) {
foreach ($vars['config']->registered_entities as $type => $ar) {
if (count($vars['config']->registered_entities[$type])) {
foreach ($vars['config']->registered_entities[$type] as $object) {
if (!empty($object )) {
$keyname = 'item:' . $type . ':' . $object;
} else {
$keyname = 'item:' . $type;
}
$contents[$keyname] = "{$type},{$object}";
}
} else {
$keyname = 'item:' . $type;
$contents[$keyname] = "{$type},{$object}";
}
}
}
Change History (3)
comment:1 Changed 2 years ago by cash
- Difficulty set to easy
- Milestone changed from Needs Review to Elgg 1.7.7
- Summary changed from activity filtering to cannot filter activity by user or group due to no subtype
comment:2 Changed 2 years ago by cash
- Resolution set to fixed
- Status changed from new to closed
comment:3 Changed 2 years ago by brettp
(In [svn:8367]) Refs #2697, #2956. Ported fix to show users and groups in river filter to trunk.

(In [svn:7968]) Fixes #2697 added groups and users back to activity filter