Hi all!
I'm developing a plugin that modifies the registration form, by allowing the new users to directly subscribe to some groups, previously tagged with a Group Profile Fields, created with Jeroen Dalsem's Profile Manager plugin.
For instance: I've created a Group Profile Field called "AllowDirectRegistration", with yes or no as values, only admin-visible. Now I want to get the list of groups marked as "yes", to fill a dropdown. Up to now, I've been using this code to get the list of all available groups:
$groups = elgg_get_entities(array(
'type' => 'group',
'limit' => 0,
'joins' => array("JOIN " . $dbprefix . "groups_entity g on e.guid = g.guid"),
'order_by' => "g.name ASC",
));
but now I need to show only those marked as "AllowDirectRegistration" with the value "yes".
I've tried to read the Profile Manager code to understand how this field is stored in the database, but as a beginner in elgg, I'm half blind on this...
Thanks in advance!
Nalonso
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.
- nalonso@nalonso
nalonso - 0 likes
You must log in to post replies.Answering my own question:
Just leave the query like it is, and check for the metatag "AllowDirectRegistration" before including the options in the dropdown box, like:
foreach($groups as $group){
if ($group->AllowDirectRegistration == 'yes') {
$options_values[$group->guid] = $group->name;
}
}
Best regards,
nalonso