Search code examples
javaliferayliferay-6

Check if liferay community is active or not


I need check if the community is active or not through code. I am using Liferay 6.0.6 CE.

When I fetch myPlaces using List<Group> myPlaces = user.getMyPlaces(max); I get all the not active communities in the list as well which I don't want. I want only the active communities to be returned in the List.


Solution

  • Sometimes it is necessary to program a little bit self :)

        List<Group> myActivePlaces = new ArrayList<Group>();
        List<Group> myPlaces = user.getMySites();
        for (Group group : myPlaces) {
            if(group.isActive()){
                myActivePlaces.add(group);
            }
        }