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.
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’ directly works perfectly. Accessing from ‘http://www.example.com/example’ does a redirect to ‘http://www.example.com/forums’.
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?
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.
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.
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!