Example #1
0
function find_groups_by_tag_title($options, $tag)
{
    $options['by_tag'] = true;
    $options['by_title'] = false;
    $resByTag = zhgroups_find_groups($options, $tag);
    $entitiesByTag = $resByTag["entities"];
    $countByTag = $resByTag["count"];
    $options['by_tag'] = false;
    $options['by_title'] = true;
    $resByTitle = zhgroups_find_groups($options, $tag);
    $entitiesByTitle = $resByTitle["entities"];
    $countByTitle = $resByTitle["count"];
    if ($countByTag == 0) {
        return $resByTitle;
    }
    if ($countByTitle == 0) {
        return $resByTag;
    }
    $options['by_tag'] = true;
    $options['by_title'] = true;
    $options['count_only'] = true;
    $resIntersect = zhgroups_find_groups($options, $tag);
    $countIntersect = $resIntersect["count"];
    $entities = merge_entities_by_guid($entitiesByTag, $entitiesByTitle);
    $count = $countByTag + $countByTitle - $countIntersect;
    $result = array("entities" => $entities, "count" => $count);
    return $result;
}
Example #2
0
                $db_prefix = elgg_get_config('dbprefix');
                $query = "UPDATE {$db_prefix}access_collections SET name = '{$ac_name}' \n\t\t\t\t\tWHERE id = {$group->group_acl}";
                update_data($query);
            }
        }
        $group->{$shortname} = $value;
    }
}
// Validate create
if (!$group->name) {
    register_error(elgg_echo("groups:notitle"));
    forward(REFERER);
}
if ($is_new_group) {
    $options = array('by_title' => true, 'count_only' => true);
    $result = zhgroups_find_groups($options, $group->name);
    if ($result["count"] > 0) {
        register_error(elgg_echo("groups:duptitle"));
        forward(REFERER);
    }
}
if (!$group->interests) {
    register_error(elgg_echo("groups:nointerests"));
    forward(REFERER);
}
// Set group tool options
$tool_options = elgg_get_config('group_tool_options');
if ($tool_options) {
    foreach ($tool_options as $group_option) {
        $option_toggle_name = $group_option->name . "_enable";
        $option_default = $group_option->default_on ? 'yes' : 'no';