#450 closed Enhancement (fixed)
Enabling entity doesn't enable it's children entities.
| Reported by: | zhoppy | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.6 |
| Component: | Core | Version: | 1.8 |
| Severity: | minor | Keywords: | |
| Cc: | brettp | Difficulty: |
Description (last modified by cash)
Problem: Trying to unban a user doesn't work properly as their widgets aren't available.
The admin/user/ban action will set the enabled column in the entity table to 'no' for that user's entity and all of the entities that belong to it.
The admin/user/unban action, which calls ElggUser::enable(), doesn't change the enabled value for the user's children entities (widgets.) So the user's profile shows up again but without any widgets.
My proposed solution is add a function called enable_entites($parent_guid) to the entities lib and to override the enable function in ElggUser to call both the parent ElggEntity enable function as well as enable_entites.
Add to: engine/lib/entities.php
/**
* Enable an entities' children. Make sure you enable the entity first as well
*
* @param int $guid The parent entity's guid.
*/
function enable_entities($parent_guid) {
global $CONFIG;
$parent_guid = (int)$parent_guid;
// Override access only visible entities
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(true);
$entities = get_entities("", "", $parent_guid, "", 0);
access_show_hidden_entities($access_status);
$result = true;
foreach($entities as $entity) {
$result &= enable_entity($entity->guid);
}
return $result;
}
Add to engine/lib/users.php:
public function enable() {
if(parent::enable()) {
return enable_entities($this->get('guid'));
}
return false;
}
Change History (7)
comment:1 Changed 4 years ago by marcus
- Resolution set to fixed
- Status changed from new to closed
comment:2 Changed 11 months ago by srokap
- Resolution fixed deleted
- Status changed from closed to reopened
- Summary changed from Enabling entity doesn't enable it's children entities. (Banning/unbanning users) to Enabling entity doesn't enable it's children entities.
- Version changed from 1.0 to 1.8
Bug with enabling of children entities still occurs in head 1.8 branch. Entities enabled recursively are limited to 10 items by default.
comment:3 Changed 11 months ago by srokap
Pull request for this ticket: https://github.com/Elgg/Elgg/pull/271
comment:4 Changed 11 months ago by cash
- Description modified (diff)
- Milestone set to Elgg 1.8.6
Thanks for catching this!
comment:5 Changed 11 months ago by Srokap
- Resolution set to fixed
- Status changed from reopened to closed
Fixes #450 Enabling entity doesn't enable it's children entities.
Changeset: 34de6036015f072cd809c3240228f56b23c7de91
comment:6 Changed 11 months ago by Cash Costello
Merge pull request #271 from Srokap/ticket_450
Fixes #450 Enabling entity doesn't enable it's children entities.
Changeset: 19e2a8d99b0aab82e8213d171547486500b0784f
comment:7 Changed 11 months ago by Srokap
Fixes #450 Enabling entity doesn't enable it's children entities.
Changeset: 34de6036015f072cd809c3240228f56b23c7de91

Banning method has now been changed so as to not physically disable a user.