I'm struggling to see the metadata relationship between groups and discussion topics? I can see that when a new topic is saved the group is set as its container_guid, but I don't think this helps at all.
I'm leaning towards overriding or extending the discussion/save action, creating a relationship between the topic and the group and then searching with elgg_get_entities_from_relationship_count().
Does this sound reasonable? Or am I missing something obvious with the metadata?
Thanks
No, I think Pawel meant that you can search groups based on the "forum_enable" metadata.
$groups = elgg_get_entities_from_metadata(array(
'type' => 'group',
'metadata_name_value_pairs' => array(
'name' => "forum_enable"
'value' => "no",
'operand' => '!='
),
'limit' => false
));
This will return all groups that have group discussions enabled.
I see. Thanks.
Although I still can't see how you could order the results based on the number of topics, as they are not stored as metadata? I think you may still need a JOIN (or something!) to do that?
I've actually done it my way now, it was quite simple and I think it makes the ordering easier. It also means that results will only show up if at least one discussion topic has been created.
@Juho Jaakkola :) There is another CSS trick.
I meant create CSS style and add link class into menu:item.
In css.php
.elgg-menu-page li.elgg-state-selected > a {
color: white;
}
.elgg-menu-page li > a.elgg-state-selected {
color: black;
}
Sure, it's works for menu:page only.
For other items need to create similar styles too, e.g.:
.elgg-menu-extras li > a.elgg-state-selected {
color: white;
}
.elgg-menu-extras li.elgg-state-selected > a {
color: black;
}
Make all your plugin pages push a context like "vendor_myplugin". Give your site menu item the same name.
Elgg has a built-in menu handler that will auto-select the item based on current (topmost) context.
Thanks for the answers everyone.
For clarity, if anyone else has the same question in the future:
My menu item was setup using
$item = new ElggMenuItem('item_name', elgg_echo('Menu Label'), 'plugin/link');
elgg_register_menu_item('site', $item);
Then on each plugin page where I want to highlight that menu item I used
elgg_push_context('item_name');
Seems to work anyway!
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.