I added a function resembling get_user_by_username for groups. Perhaps there is a clean way to do it without this function.
I haven't cached the results, do you think it's necessary for this kind of query?
I could add this function in a plugin but thought this could go into the core if you think it's appropriated.
Let me know what you think.
Add function to get all groups with a given name
Am I missing something? I thought group names were not unique, where as usernames are, so this would return an array of groups with the same name?
If we are happy retrieving an array, we should then perhaps generalize the function - get_entities_by_name and get_entities_by_title.
get_entities_from_attributes would be very helpful, similar to get_entities_from_metadata.
@cash for the problem I'm trying to solve now I think I can manage with elgg_get_entities, thanks for the tip.
@hypeJunction Group names are not unique just like email addresses don't have to be unique (see get_user_by_email()).
Good point on retrieving by attributes. Right now there are either separate functions for each attribute or it requires custom join/where clauses.
I added a ticket for better support for entity attributes: http://trac.elgg.org/ticket/4215
I'm closing this pull request since the general solution is a better solution and elgg_get_entities() does what is currently needed.