Add function to get all groups with a given name #109

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@jdnavarro
Contributor

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.

@hypeJunction
Contributor

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.

@jdnavarro
Contributor

get_entities_from_attributes would be very helpful, similar to get_entities_from_metadata.

@jdnavarro
Contributor

@cash for the problem I'm trying to solve now I think I can manage with elgg_get_entities, thanks for the tip.

@cash
Contributor
cash commented Dec 13, 2011

@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.

@cash
Contributor
cash commented Dec 16, 2011

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.

@cash cash closed this Dec 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment