• Hi all,
    I have a internal WP site (running on Ubuntu) that is used to provide employees with info, notices etc. What I would like to do is create a link to a network share on a 2003 server. For instance, \\servername\docs – so that when they click on the link, IE opens up a page with the docs.

    Every time I try to create the link, it goes back to a HTML site instead of the path.

    Any idea on how to do this?

    Thanks,
    Rob

Viewing 4 replies - 1 through 4 (of 4 total)
  • In order to do this you need to create file:// link to the network share required however the built in menu system doesn’t allow links starting like this. I too would like to know this…..

    Guys,

    I just had the same problem and hoped to find a plugin as always when wanting WordPress to do something that can’t be done out of the box… but this time without success. ??

    What I have found is that WP 3.4.2 uses a funtion returning the allowed protocols. I found it in wp-include\functions.php named wp_allowed_protocols(). Adding ‘file’ to the array did the trick.

    Since it’s not the best idea to edit core files of WP I ended up with following solution, which works like a charm:

    1. create a directory (if not already existing) named wp-content\mu-plugins
    2. create a file in the mu-plugins folder e.g. called allowFileLink.php
    3. copy & paste the following code snippet into the file and that’s it
    4. <?php
      function custom_allowed_protocols() {
      	static $protocols;
      
      	if ( empty( $protocols ) ) {
      		$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'file' );
      		$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
      	}
      
      	return $protocols;
      }
      
      $hook = wp_allowed_protocols;
      add_filter($hook,custom_allowed_protocols);
      ?>

      You now can add links like file:///X:/somefolder/somesubfolder/sometextfile.txt

      Let me know if it works for you. If you have better solutions than this fast hack, please provide them.

      Cheers
      Sascha

    Today I noticed that this mu-plugin somehow only works for Administrators. So I ended in editing the functions.php directly… that’s damn ugly!
    I noticed that plugins should be able to change the allowed protocols but I did not find a way to get it work. One problem could be that the $protocols is a static variable, but why did it work for the admin anyway?

    Seems to me, that I don’t understand the process how WP is cleaning up URLs… I could really need some help here.

    After a little bit more research, the solution seems to be already provided here: link to local file

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Intranet Site – link to a network share?’ is closed to new replies.