Re: Getting Plugin URL
BB_PLUGIN_URL is useless as there are several places a user can put a plugin. Most users also don’t know they aren’t supposed to use bb-plugins
and make my-plugins
because the powers that be refuse to ship bbpress with a pre-made my-plugins
directory.
After much trial and error and problems reported by windows users, I figured this out:
$url=bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\"),"\"),array("","/"),dirname(__FILE__)),' /\').'/';
$path=rtrim(dirname(__FILE__),' /\').'/';
Where $url is the full uri to the local plugin’s directory (ie. if you have an image in there, that’s the url to it)
The $path is the local storage path that will work in both windows and linux.
It may look like these functions can be simplified but if you do that, I guarantee you’ll break it under one environment or another.