Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Moving Vanilla's directory
What would I have to do to move Vanilla to a different directory? What would I have to change?
0
This discussion has been closed.
Comments
Set it to 0 and guests don't see the page until they log in.
At the top of the default.php there's the code for if guest:
$Context->Session->UserID >= 0;
or if logged in:
$Context->Session->UserID->RoleID;
Futher down the add-on checks this context and displays it accordingly.
if (!$_GET['menu']) { $_GET['menu'] = 'home'; } if ($_GET['menu']=='home') { ShowHomePage(); } elseif ($_GET['menu']=='feature') { ShowFeaturePage(); } elseif ($_GET['menu']=='docs') { ShowDocsPage(); } elseif ($_GET['menu']=='download') { ShowDownloadPage(); } else { ShowErrorPage(); }
This part determines which function to 'display' based on a menu that I've set up in said document:
if ($_GET['menu'] == 'home') { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=home" class="active"> Home </a></td>'; } else { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=home" class="menu"> Home </a></td>'; } if ($_GET['menu'] == 'feature') { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=feature" class="active"> Features </a></td>'; } else { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=feature" class="menu"> Features </a></td>'; }
What I want to be able to do, is test whether the user is logged in or not and refuse to display a certain function unless they first log in. I chose to put it all on one tab, because I was having so many problems with using multiple tabs. I kinda like it this way better.
Instead shift the "if $context" part to apply only to the relevant sub-menu elements. They will then simply not appear if the user is not logged in. I guess that's why the GuestWelcome plug-in refers generally to "more functionality" if not logged in.
You could also look at Mark's PrivateAccounts add-on, which checks to see if the user is logged in when a user search is made. He makes the function die() at the end, but you could make it display a message instead:
if ($Context->SelfUrl == 'account.php' && $Context->Session->UserID == 0) { header('location:'.GetUrl($Configuration, 'index.php')); die(); }
Again, it's the same principle of $Context->Session->UserID or RoleID.
echo 'test '.$Context->SelfUrl.' '.$Context->Session->UserID.' test';
which results in just 'test test';
if (($_GET['menu'] == 'home') && $Context->Session->User->RoleID) { echo 'the menu button that only logged in users should see'; }
AFAIK: the role's look like this:
UserID == 0, means not logged on, e.g. Guest (e.g. in the GuestWelcome add-on)
UserID >= 0, means guests and all roles above, e.g. everyone
User->RoleID, means if a RoleID exists altogether, e.g. logged in
If you want to check against specific permissions then you do it like this:
User->Permission('PERMISSION_DATABASE_CLEANUP') (quoted in cleanup add-on)