php - Hide elements if user is not logged in Omeka -
i trying hide elements in array based on if user logged in or not. instance, if user not logged in, don't want them able view "subject" element.
in items folder in show.php file, there line of code think needs edited.
<?php echo all_element_texts('item'); ?>
is there way use like
if current user display element else hide?
thanks
used code jeremey boggs
<?php /** * unset elements if there not current authenticated user. */ function filter_elements($elementsbyset) { /* array of elements in sets hidden non-authenticated users. */ $hiddenelements = array( 'dublin core' => array( 'description', 'creator' ) ); if (!current_user()) { foreach ($hiddenelements $setname => $elementnames) { foreach ($elementnames $elementname) { unset($elementsbyset[$setname][$elementname]); } } } return $elementsbyset; } add_filter('display_elements', 'filter_elements');
Comments
Post a Comment