smozgur
Well-known member
Hello,
Here is the scenario. I want to show the "XFES: Similar Threads" widget in a "Question" type forum only. Here is the condition which works well:
	
	
	
		
I also created a custom user field to allow users to hide the widget as a preference. Instead of creating a template modification to check the user preference (which works without problem), I wanted to use the widget display condition as I can access the Profile entity in the widget context. So here is the condition for that - bc_hide_similar_threads is the custom user field id:
	
	
	
		
Both conditions work great separately. So I was too sure that it will work if I combined them by using AND, which is an obvious thing! Anyway, I created an HTML widget to make sure with the following template:
	
	
	
		
And this returns the correct boolean value as expected. So I should be able to use the following as the widget display condition:
	
	
	
		
But it doesn't work!
Could you please show me what I am missing in this?
Thanks.
				
			Here is the scenario. I want to show the "XFES: Similar Threads" widget in a "Question" type forum only. Here is the condition which works well:
		PHP:
	
	$context.thread.discussion_type == 'question'I also created a custom user field to allow users to hide the widget as a preference. Instead of creating a template modification to check the user preference (which works without problem), I wanted to use the widget display condition as I can access the Profile entity in the widget context. So here is the condition for that - bc_hide_similar_threads is the custom user field id:
		PHP:
	
	!$xf.visitor.Profile.custom_fields.bc_hide_similar_threadsBoth conditions work great separately. So I was too sure that it will work if I combined them by using AND, which is an obvious thing! Anyway, I created an HTML widget to make sure with the following template:
		PHP:
	
	{{dump($context.thread.discussion_type == 'question' AND !$xf.visitor.Profile.custom_fields.bc_hide_similar_threads)}}And this returns the correct boolean value as expected. So I should be able to use the following as the widget display condition:
		PHP:
	
	$context.thread.discussion_type == 'question' AND !$xf.visitor.Profile.custom_fields.bc_hide_similar_threadsBut it doesn't work!
Could you please show me what I am missing in this?
Thanks.
 
 
		 
 
		 
 
		 
 
		