/**
 * When an entity is updated, resets the access ID on all of its child metadata
 *
 * @param string     $event       The name of the event
 * @param string     $object_type The type of object
 * @param ElggEntity $object      The entity itself
 *
 * @return true
 * @access private Set as private in 1.9.0
 */
function metadata_update($event, $object_type, $object)
{
    if ($object instanceof ElggEntity) {
        if (!is_metadata_independent($object->getType(), $object->getSubtype())) {
            $db_prefix = elgg_get_config('dbprefix');
            $access_id = (int) $object->access_id;
            $guid = (int) $object->getGUID();
            $query = "update {$db_prefix}metadata set access_id = {$access_id} where entity_guid = {$guid}";
            update_data($query);
        }
    }
    return true;
}
Exemple #2
0
/**
 * When an entity is updated, resets the access ID on all of its child metadata
 *
 * @param string $event The name of the event
 * @param string $object_type The type of object
 * @param ElggEntity $object The entity itself
 */
function metadata_update($event, $object_type, $object)
{
    if ($object instanceof ElggEntity) {
        if (!is_metadata_independent($object->getType(), $object->getSubtype())) {
            global $CONFIG;
            $access_id = (int) $object->access_id;
            $guid = (int) $object->getGUID();
            update_data("update {$CONFIG->dbprefix}metadata set access_id = {$access_id} where entity_guid = {$guid}");
        }
    }
    return true;
}