Info
- 6 posts
- 1 voice
- Started 2 years ago by yutt
- Latest reply from yutt
- This topic is resolved
Plugin custom pages
-
- Posted 2 years ago #
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?
-
- Posted 2 years ago #
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.
-
- Posted 2 years ago #
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?
-
- Posted 2 years ago #
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.
-
- Posted 2 years ago #
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.
-
- Posted 2 years ago #
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!
-
You must log in to post.