HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Moving Vanilla's directory

edited August 2006 in Vanilla 1.0 Help
What would I have to do to move Vanilla to a different directory? What would I have to change?

Comments

  • only the paths in conf/settings.php ;)
  • To answer my own question, I just went ahead and moved it and then re-ran the setup script. Yet, I have another question... I've created a custom page, within this page is a PHP postback script, to display different things, depending on a menu selection. I want to be able to deny access to some of these postback pages, depending on if the user is logged in or not. IE: I've made a homepage like tab, I want guests to be able to view all of the pages in this except for the download ones, I want them to have to register first. How can I test if a person is logged in or not? <a href="http://skyblue.mine.nu/>http://skyblue.mine.nu/</a>; SkyBlueshoes
  • skyblueshoes, in the HelpPage add-on I sent you there's a setting: $NewTab_GuestRead = 1;
    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.
  • No, that is not what I mean. Here is a snippet of my code in my_newtab.php:

    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">&nbsp;Home&nbsp;</a></td>'; } else { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=home" class="menu">&nbsp;Home&nbsp;</a></td>'; } if ($_GET['menu'] == 'feature') { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=feature" class="active">&nbsp;Features&nbsp;</a></td>'; } else { echo '<td align="left"><a href="http://skyblue.mine.nu/index.php?page=home&menu=feature" class="menu">&nbsp;Features&nbsp;</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.
  • If you want to simply make certain submenus not appear, you can use the same check above but for those items only, i.e. your home page should always show, so there's no need to check if the whole page should show if the user is a guest.

    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.
  • hmmm, well, I'm not able to get the $Context->SelfUrl or the $Context->Session->UserID to display ANYTHING, it's like they don't exist in my page, but I know they do cause all my content is loading...

    echo 'test '.$Context->SelfUrl.' '.$Context->Session->UserID.' test';

    which results in just 'test test';
  • edited May 2006
    I don't quite follow your example. I'm not the PHP profi myself and most of what I have learnt for vanilla is by looking at how other add-ons have done it, or the main code (my disclaimer :-). A lot of add-on's begin with (expressed in English) "check context = which page are we on AND check context = what role do we have" then show/do this or that. So in this case I would add the "check context = user is logged on" to the line that displays your menus, e.g.:

    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)
  • edited August 2006
    comment/post virtually deleted ###
This discussion has been closed.