Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin custom pages


  • yutt
    Member

    @yutt

    Can plugins have their own standalone pages?

    I have a very basic plugin that attempts to do this, but it displays both my output, and then the entire index page below it. I suspect this has something to do with the ‘bb_get_location’ function, but I don’t know how to resolve it.

    my-plugin.php

    include_once(rtrim(dirname(__FILE__),' /\').'/my-plugin-core.php');
    if (isset($_GET['my-plugin'])) {
    add_action( 'bb_init', 'display_deals');
    }

    my-plugin-core.php

    echo "Example";

    Can someone tell me the proper way to do this? Do I need to link directly into the ‘/bb-plugins/my-plugin/’ directory?

Viewing 5 replies - 1 through 5 (of 5 total)

  • yutt
    Member

    @yutt

    Okay, I ended up going a totally different route with this, I don’t know that it will work for everyone or if it is “proper”, but it works for me.

    my-plugin.php now has:

    include_once('my-plugin-core.php');
    include_once('../../bb-load.php');

    From there I check if the user is authenticated as an admin with:

    bb_ssl_redirect();
    bb_auth();

    After that I just call ‘my-function();’

    I will use mod_rewrite to make the URL less ridiculous.


    yutt
    Member

    @yutt

    Alright, now I am having *serious* issues getting Rewrite Rules to work.

    I’ve done these dozens of times and they aren’t particular complicated, here is a brief example of what I am trying to do:

    RewriteBase /
    RewriteRule ^example/?$ /forum/bb-plugins/example/example.php [NC,L]
    </IfModule>

    Accessing ‘http://www.example.com/forum/bb-plugins/example/example.php&#8217; directly works perfectly. Accessing from ‘http://www.example.com/example&#8217; does a redirect to ‘http://www.example.com/forums&#8217;.

    There are NO other rewrite rules active. I even disabled those from bbpress to try to track down what is happening. But some sort of 302 redirect keeps occurring. Is bbpress triggering this internally somehow?


    yutt
    Member

    @yutt

    A friend of mine helped me to determine this *is* being done by bbpress, most likely as some referral rule system. How do I get around this? I would like to be able to access my page from a rewritten URL.


    yutt
    Member

    @yutt

    So…

    bb_auth(); in ‘functions.bb-pluggable.php’ is causing this redirection problem.

    I appear to be failing at the line:

    if ( !bb_validate_auth_cookie( '', $scheme ) ) {

    I’ll have to look into bb_validate_auth_cookie() to see where that leads.


    yutt
    Member

    @yutt

    Well, I replaced the:

    bb_auth();

    line with:

    if (!bb_current_user_can('administrate')) {bb_auth();}

    Hopefully that is secure, everything seems to work now. Huzzah!

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