I am creating a bbPress Plugin (actually editing a wordpress plugin). I want to get the plugin url link. How to get that? I am stuck there.......
Getting Plugin URL
(6 posts) (4 voices)-
Posted 8 months ago #
-
You can submit plugins here:
http://bbpress.org/plugins/forum/requestsOnce they're approved, you'll get a bbPress URL for your plugin. :-)
Posted 8 months ago # -
I think gautam2011 means outputting the path to bbPress' plugin URL directory.
Is there a constant variable like WP_PLUGIN_URL?
I'm looking for this too! I'm porting a WP plugin over.[EDIT]
Found it! It's in bb-settings.phpThe variable is BB_PLUGIN_URL.
Simple as that! :)Posted 8 months ago # -
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-pluginsand makemy-pluginsbecause the powers that be refuse to ship bbpress with a pre-mademy-pluginsdirectory.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.
Posted 8 months ago # -
Thanks ck...
But, you forgot to escape \.
So, the correct code is:
$url = bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\"),"\"),array("","/"),dirname(__FILE__)),' /\').'/';Posted 8 months ago # -
Oh...
The forum changed double \ into single \Posted 8 months ago #
Reply
You must log in to post.