Forums

Join
bbPress Support ForumsPluginsGetting Plugin URL

Info

Tags

Getting Plugin URL

  1. 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.......

  2. You can submit plugins here:
    http://bbpress.org/plugins/forum/requests

    Once they're approved, you'll get a bbPress URL for your plugin. :-)

  3. 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.php

    The variable is BB_PLUGIN_URL.
    Simple as that! :)

  4. 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.

  5. 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__)),' /\').'/';

  6. Oh...
    The forum changed double \ into single \

  7. You must log in to post.