elgg_get_entities_from_metadata help

Ok I'm trying to use elgg_get_entities_from_metadata and have found many examples but I dont understand what is the metadata "name"? where do I find metadata name? I looked in database and all metadata has is ID, name ID and value ID, and seems like the values are stored in metastrings table.

Is metadata name a field name? for example in lib/groups I see "'metadata_name' => 'interests'," which coresponds with group "Tags" profile field. Is that what it is?

Thanks for helping me understand this better.

  • Yes metadata names are field names like username, title, description, tags, personal interests, location... etc. 

  • Yes "metadata" can be considered as a field name, or you can say they the virtual "columns" which store value. As Elgg uses EAV model (http://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) so each entity can have any number of metadata. This helps in maintain the Plugable structure of Elgg very well as new plugins can introduce any kind of data without even touching the database.

    All the metadata names and their values are stored in "metastrings", so the ids in the metadata table actually map to the id from the table metastrings.

    Hope this helps you to understand the metadata and metastring better.