public static function set_relation($uid, $gid, $relation_type) { if (empty($relation_type)) { $relation_type = 'member'; } // we need more info about the entity $entity_info = TypedGroupEntity::load_for_group($gid, false); if (empty($entity_info)) { return FALSE; } $relation = array('subject_service' => 'internal', 'subject_type' => 'user', 'subject_id' => $uid, 'object_service' => 'typedGroup', 'object_type' => $entity_info['entity_type'], 'object_id' => $gid); parent::delete_match($relation); $relation['relation_type'] = $relation_type; $relation['start_time'] = time(); $relation['attributes'] = array(); parent::sync($relation); }