 
	
		Tagged: search form
- 
		AuthorPosts
- 
		
			
				
January 11, 2019 at 6:11 am #1052574Hi. 
 My site is a member-only site. However, when I put the search form beside the menu bar, the problem was that users who did not log in would be able to use the search function.I wonder if I can make the search icon visible only to login users. 
 If that is not possible, I’d like to be able to add the search icon to the top of every page, not the menu bar.Can I get help? January 11, 2019 at 8:34 am #1052629well there is an if clause that could fit for your needs: 
 if(is_user_logged_in())
 but the most elegant method would be to influence the header_searchicon from Enfold Options dialog.
 This here only hides or shows the search – but better would be that there is no search in the menu
 (comes to functions.php of your child theme)function login_state(){ if(is_user_logged_in()){ ?> <script> jQuery("#menu-item-search").css("display", "block"); </script> <?php } else{ ?> <script> jQuery("#menu-item-search").css("display", "none"); </script> <?php } } add_action('wp_footer', 'login_state');maybe a filter like avf_header_setting_filter could do the needed trick – but i do not see how to ( on that early time ) January 11, 2019 at 9:05 am #1052641Aha here is the solution – and it comes to functions.php of your child-theme 
 thanks to Dudeadd_action('init', 'avia_remove_search_for_logged_out_users', 10); function avia_remove_search_for_logged_out_users(){ if(! is_user_logged_in()){ remove_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 9997, 2 ); remove_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 9997, 2 ); } }January 11, 2019 at 6:08 pm #1052824Hi, Guenni007 
 Thank you for your kind reply. I will try it. And I will give you feedback again.January 11, 2019 at 6:17 pm #1052829Wow! It’s very simple, and works well. 
 Thank you very much.January 11, 2019 at 7:23 pm #1052863Not for that – your welcome January 12, 2019 at 6:53 am #1052989Hi, Thanks for helping out @guenni007, much appreciated. Please let us know if you should need any further help on the topic or if we can close it @leekiya. Best regards, 
 Rikard
- 
		AuthorPosts
- You must be logged in to reply to this topic.
