Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting Plugin URL

  • @gautam2011

    Member

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • @johnhiler

    Member

    You can submit plugins here:

    https://bbpress.org/plugins/forum/requests

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

    @r-a-y

    Participant

    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! :)

    @_ck_

    Participant

    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.

    @gautam2011

    Member

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

    @gautam2011

    Member

    Oh…

    The forum changed double into single

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar