Elgg core bug or not: creation of invalid entities (with no owner / invalid owner) possible?

The problem is this: Within the Feedback plugin to allow for anonymous users to provide feedback (when not logged in) the entity used to save the feedback is created without explicitely assigning an owner_guid and/or container_guid. If a logged-in user adds feedback, the entity is created with the logged in user guid automatically nonetheless - no problem with that.

But feedback entities created when not logged in are created with owner_guid and container_guid "0" automatically. While this might not be the best way to do it, this worked when implemented (at that time Elgg 1.8.6 was the most recent release). The feedback given could be displayed / deleted etc. without issues. I only noticed that it works no more now (on Elgg 1.8.17) when working on a new version of the Feedback plugin. I have no idea since which version of Elgg it fails to work as before.

The creation of the entity still happens with owner_guid "0". But these feedback entries are no longer shown on the site and deleting the entries using the delete() method also fails. Only by using the Database Validator plugin the invalid database entries can be fixed (which means they get deleted).

So, questions:

  • if an entity with owner_guid "0" is invalid why does it get created in the first place? Bug?
  • is there any recommended way how to allow for creation of entities without an owner available? A possible way is to set the site_guid as owner. But this only works when elgg_set_ignore_access() is used.
  • i noticed yesterday that (if i recall correctly) the group entities have an owner guid of 0.. i thought the owner would be the admin or the site.. but when i dumped the value it was 0.

  • @ura: are you sure? I see that rather the user entities have "0" as owner_guid (who should own them anyway?) while the owner_guid of groups is the user_guid of the group owner.

    But I'm referring to object entities. I can understand that an entity with owner_guid "0" is somehow invalid. But I'm confused that the plugin worked before and doesn't anymore now and that Elgg creates invalid entities in the first place. In addition to that I would like to know the recommended way to create object entities when there's no owner available.

  • ah, most likely you are correct.. i probably had an error in the code somewhere i was using.

     

  • the lack of complete documentation is ultimately the source of these confusions (from the perspective of one who is trained to create formal design documents before writing a line of code - not that i always do.) ;)

    i see the documentation is being evolved in github - maybe soon this will all be formalised.