Page 1 of 1

Hide some div's from Group visitor

Posted: 2020-05-18 21:53
by Jay Webb
I'm using appgini 5.82

Hello:
I'm trying to hide some div's that I have in templates/individuals_templateDV.html from group visitor.
Div's are #non, #positive, #rfresh,

I'm using code from post viewtopic.php?t=465
I have this code in my footer-extra.php

Code: Select all

<?php
	$memberInfo = getMemberInfo();
		if($memberInfo['group'] !='visitor'){
?>
<script type='text/javascript'>
	document.observe("dom:loaded", function() {
		$j('#non, #positive, #rfresh').hide();
			});
</script>
<?php
}
?>
It works, but the problem is it hides the div's for all groups when it's only group visitor that's coded for.
I tried adding a esle statement

Code: Select all

<?php
	$memberInfo = getMemberInfo();
		if($memberInfo['group'] !='visitor'){
?>
<script type='text/javascript'>
	document.observe("dom:loaded", function() {
		$j('#non, #positive, #rfresh').hide();
    }else{
			  $j('#non, #positive, #rfresh').show();
		});
</script>
<?php
}
?>
but that didn't work, showed div's back for all groups.
90% of the time I can figure it out, but it's the other 10% I spend hours and hours stumped.
Not sure how to move forward or what's missing.

Re: Hide some div's from Group visitor

Posted: 2020-05-19 00:19
by Jay Webb
Yep ee, got it working, jumped from the foot-extra.php and used the hooks/TABLENAME.php file
forked the code

Code: Select all

	function individuals_dv($selectedID, $memberInfo, &$html, &$args) {

if(isset($_REQUEST['dvprint_x'])) return;
		
		ob_start(); ?>
		
		<script>
		
		<?php if ($memberInfo['group'] == 'Visitor' ){?>

			$j(function(){
			
			$j('#non, #positive, #rfresh').hide();

			}); 
				
			    
		<?php }else{; ?>
		
			$j(function(){
			
			$j('#non, #positive, #rfresh').show();

			}); 
				
				
		<?php }; ?>
					
			
		</script>
		
		<?php
		$form_code = ob_get_contents();
		ob_end_clean();
		
		$html .= $form_code;

	}
and that did the trick