MyBB Community Forums

Full Version: help please!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello, how do I make users have to register, or log in to access the content of an extra page that I have put in my forum?
hi, one way is get view access from guests in forums permissions. (remember set bots on registered groups that be able read your contents)
(2022-11-24, 09:38 PM)Mostafa.Shiraali Wrote: [ -> ]hi, one way is get view access from guests in forums permissions. (remember set bots on registered groups that be able read your contents)

but I mean an extra page, I have created a new page in the root directory of my web.  Example https://forum.com/example/ so I want to know how to make only registered users can access that extra page
something like this :

if($mybb->user['uid'] > 0)
{
//your page code
}
else
{
error("only registered users can acess to this page");
}
(2022-11-25, 08:38 AM)Mostafa.Shiraali Wrote: [ -> ]something like this :

if($mybb->user['uid'] > 0)
{
//your page code
}
else
{
error("only registered users can acess to this page");
}

thank you very much, you are the best

(2022-11-25, 08:38 AM)Mostafa.Shiraali Wrote: [ -> ]something like this :

if($mybb->user['uid'] > 0)
{
//your page code
}
else
{
error("only registered users can acess to this page");
}

One last question brother, what do you mean by the code of my page, and where can I see it?
you said you have a extra page so you can put your php extra page codes in this condition to show only to registered users
I didn't understand very well, but what I did was place the code that you gave me, in the .php of my extra page.  Can you tell me what else I need to do?

<?php

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

add_breadcrumb("Improvements", "improvements.php");

eval("\$html = \"".$templates->get("template_name")."\";");

output_page($html);

if($mybb->user['uid'] > 0)
{
//your page code
}
else
{
error("only registered users can access this page");
}

?>

(2022-11-25, 06:35 PM)Mostafa.Shiraali Wrote: [ -> ]you said you have a extra page so you can put your php extra page codes in this condition to show only to registered users

Hello, I already did everything, but if you go to my extra page *https://eliteforums.cf/mejoras.php* you will see that the code of my main page is mixed with that of my extra page, so everything looks very ugly, you know What I can do?