Extend the access input's view:
$access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT);
if (!elgg_is_admin_logged_in()) {
$access_options[ACCESS_LOGGED_IN] = elgg_echo('LOGGED_IN');
$user_guid = elgg_get_logged_in_user_guid();
$dbprefix = elgg_get_config('dbprefix');
$query = "SELECT * FROM {$dbprefix}access_collections
WHERE owner_guid = {$user_guid}
AND site_guid = 1
ORDER BY name ASC";
$collections = get_data_row($query);
foreach($collections as $collection){
$access_options[$collection->id] = $collection->name;
}
$field = [
'#type' => 'access',
'name' => 'access_id',
'value' => $access_id,
'options_values' => $access_options,
'entity_type' => 'object',
'entity_subtype' => 'hjwall',
'#label' => elgg_echo('access'),
];
echo elgg_view_field($field);
}
Big thanks!
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.