Nicolas, why do you want to change subtype? just assign metadata as you already done with favcolour.
Yeah Kevin that was my understanding as well I just thought to ask if someone had a workaround. The metadata value is what i use right now I just wanted to use the subtype so i could utilize list_entities and not list_entities_from_metadata which sometimes works strangely for me ;)
-Edit: Ok from ytour answers it seems i shouldn't really bother with the subtype :) thank you very much all for the quick responses
I'm solving this with a SQL query:
$dbprefix = elgg_get_config('dbprefix');
$subtype_id = add_subtype('object', 'desired_subtype');
update_data("UPDATE {$dbprefix}entities
set subtype='$subtype_id' WHERE guid=$entity->guid");// If memcache is available then delete this entry from the cache static $newentity_cache;
if ((!$newentity_cache) && (is_memcache_available())) {
$newentity_cache = new ElggMemcache('new_entity_cache');
}
if ($newentity_cache) {
$newentity_cache->delete($guid);
}
Maybe is helpful for somebody.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.