MyBB Community Forums

Full Version: Generic Registered Users Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If this is a stupid question, then I apologize in advance. How do I go about making a (new) page that is only available to registered users that are logged in? Another way for me to ask it is: How could I create a single PHP page that validates that the requestor is logged into the forum before showing any content to the requestor?

(I realize this is how most of the forum works but I don't know PHP well enough to understand and copy all the individual components that make it work this way.)

Is there a generic format or template that I can look at to understand how this might be done? I don't need it to conform to the forum styles/templates or stay within the frames of the forum. (Though if that's easily done, that's great too.)
Please take a look at this tutorial: http://community.mybboard.net/showthread.php?tid=6615

You can change the PHP code to the following so that the content is shown to logged in users only:
<?php

require "./global.php"; // (1)

addnav("Rules page", "rules.php"); // (2)

if($mybb->user['uid'] == "0") {
    nopermission();
}

eval("\$rules = \"".$templates->get("rules")."\";"); // (3)
outputpage($rules); // (4)
?>
That worked very well! I now have a page that requires logging in first to see and use. Thank you!

But to add my custom content (using the example names above) I should edit the "rules" template directly, and not the "rules.php" file that I've created?
To add content you'd use the template called in the script, which is "rules".

If you renamed the template call (ie, changed rules to something else), you'd edit that template.

Cheers,
Chris