MyBB Community Forums

Full Version: Include your custom pages in Mybb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
This has got to be a piece of cake for someone. Please help me out.
Why is no one acknowledging this thread?
How long will I have to bump this thing until someone responds?
Ok, I finally managed to find some free time to take a look at this.

This error occurred because PHP think the file that requiring the './inc/init.php' is the first custom file, instead of global.php and therefore goes for the wrong path.

You'll have to manually edit your global.php file.

I've managed to find two solutions for this problem:
1. using the __FILE__ magic variable of php
2. make some string manipulation on the paths to find the correct path

I think the __FILE__ method is better, but I'm not sure, I've never used this before.

I'll attach my solutions in a minute...

UPDATE:
what a waste of time... almost 30 minutes for nothing, after creating and testing my solutions on my testing board (v1.4.0) I've checked it also on an updated board (v1.4.2) just to find that -
MyBB FIXED this problem in the last update!
BTW, they're using the __FILE__ method.
my conclusion: ALWAYS update your board to the last version, even the testing/development board!
Thanks this is very helpful to me
Come to think of this, you could be able to use this for a very advanced theme.
Good job! Big Grin
I've also asked it long ago:
(2007-06-21, 05:50 PM)xiao Wrote: [ -> ]
dvb Wrote:how can I restrict the new page so only registered member can view the page?

thanks for helping

add this at the top of your page:
<?php

define("IN_MYBB", 1);
require_once "./global.php";


// CHECK IF USER IS LOGGED IN
if($mybb->user['uid'] == 0)
{
    error_no_permission();
}

// DO YOUR STUFF ...

?>
good work Zaheer.........
Is there a way where my registered group needs X amount of posts to view my custom page?
Why not using the promotion system and require a specific group?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14