Hi,
I'm using Elgg 2.3.14 and I need to retrieve the data within the entity of river items to add custom properties to a new river menu item. In my start.php I'm registering a new plugin hook handler for my menu item like:
elgg_register_plugin_hook_handler('register', 'menu:river', 'river_menu_handler');
In my handler I'm doing:
function river_menu_handler($hook, $type, $items, $params) { if (elgg_in_context('widgets')) { return $items; } $item = $params['item']; $object = $item->getObjectEntity(); if (elgg_instanceof($object, 'object', 'blog')){ $auth_id = $object->$auth_id); } $options = array( 'name' => 'verify', 'href' => 'http://myfakeaddress.com', 'text' => elgg_view_icon('round-checkmark'), 'title' => 'This post has been verified', 'priority' => 200, ); $items[] = ElggMenuItem::factory($options); return $items; }
I have a custom property that is stored with every blog post when it's created called $auth_id. How can I retrieve this and other values from the blog entity after getting the object from $item->getObjectEntity()?
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.
- Jerome Bakker@jeabakker
Jerome Bakker - 1 like
- TCB@tblack06
TCB - 0 likes
You must log in to post replies.Use $object->auth_id instead of $object->$auth_id (assuming you saved the data in the metadata field auth_id
See http://learn.elgg.org/en/2.3/design/database.html#metadata
Ohh... wow.. sorry that was my oversight. Didn't even see that I had the '$' there. Thanks Jerome.