• How do I use the list of whitelisted IPs outside this plugin?
    I need to hide part of my menu from everyone else but the whitelisted IPs and I have this in my functions.php:

    function is_ip_approved() {
    	$Approved_IP_list = array(
    		"62.xx.xx.xx",
    		"91.xx.xx.xx",
    		"176.xx.xx.xx"
    	);
    	
    	if(in_array($_SERVER['REMOTE_ADDR'], $Approved_IP_list)) {
    		$is_Ip_Approved = true;
    	} else {
    		$is_Ip_Approved = false;
    	}
    	
    	return $is_Ip_Approved;
    }

    And I’m using “Menu Items Visibility Control” plugin to show the menu items if $is_Ip_Approved returns true.

    I would like to use the IP whitelist of RSA in this function so I would only need to make changes to RSA IP list and wouldn’t need to make updates to 2 different places.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @jussitrival if you’re using RSA with an allowed list of IPs, then by definition isn’t your site already only available to the allowed list of IPs? The “everyone else” won’t have access to your site so it seems you would not need to worry about hiding part of your menu. Maybe I’m misunderstanding your concern and if so can you please restate your question so I can better assist?

    Thread Starter jussitrival

    (@jussitrival)

    Hi and thanks for the reply!

    Sorry I forgot to mention that only some parts of the website are limited to specific IPs. Some parts of the website are available publicly to everyone.

    There’s one menu item which has sublinks that are only available for the whitelisted IPs so the whole menu item should be hidden (Extranet) from everyone else. I have managed this behavior already with my current set-up but I’m just looking for a way to make updating the IP list easier if I could use the same list I have set for RSA in my other function outside the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use whitelisted IPs outside this plugin’ is closed to new replies.