MyBB Community Forums

Full Version: Cannot redirect plugin to admin area after posting to public PHP page.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a plugin that when you click on a link in the Admin CP it posts data to another file but I want to redirect back to the admin page when it's done. I cannot figure this out though. Sad

My code:
redirect("../" . $mybb->settings['admin_dir'] . "/index.php?module=config/mypage");

That redirects to this link:
http://www.mywebsite.com//index.php?module=config/mypage

I got the $mybb->settings['admin_dir'] from the MyBB default template and when I check the $mybb it does show the correct directory for [admin_dir]. What am I missing?

Bah! It's $mybb->config NOT $mybb->settings... no idea where I got that from, guess I'm more tired than I thought. After changing that it started to work without a problem. Sad
Use the header function?

header("Location /* Location */");
But redirect works fine. Thanks Big Grin
Btw, you still have the problem??
Nope, I figured it out less than 5 minutes after creating this thread, I only kept the thread open to help others. Wink
you can use the built-in admin_redirect() function as well. doing so will let you use the flash_message() feature as well so the page being shown will display the success or error message