Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Removing left sidepanel on profile (themehooks)

edited August 2013 in Vanilla 2.0 - 2.8

Hey,

When designing my site, I noticed that the guest sidebar which was meant to only appear on the forums, appears on my profile pages too.

Here is an image of what the profile looks like when logged out:

Here is an image of what the profile looks like when logged in (what they should look like whether logged in or not):

I want to remove the guest module from all pages (especially profiles) except the forums, the forums look like this now (which is how they are meant to look):

How would I go about doing this?

Any help is greatly appreciated,
Thanks,
DansTooGood.

Comments

  • do you have a themehooks file?

    grep is your friend.

  • TamaTama ✭✭✭
    edited August 2013

    My bad, wrong answer

    There was an error rendering this rich post.

  • x00x00 MVP
    edited August 2013

    @Tama said:
    Navigate to default.master.tpl in your theme folder

    and add this to the elements you want hidden for guests

    {if $User.SignedIn} Content added here will only be shown to logged in users {/if}

    http://vanillawiki.homebrewforums.net/index.php/Using_Smarty_with_Vanilla

    That wasn't question he was asking.

    grep is your friend.

  • Maybe, just maybe the solution is something similar to this:

    {if $User.SignedIn}
      Content added here will only be shown to logged in users
    {/if}
    

    I need something similar myself, but haven't tried it. Let's give it a couple of guesses:


    If the Controller is 'Profile', you want to hide the 'Panel' asset and in "all other cases" you do not want to hide the 'Panel' asset. Does that help a bit? Now you need to figure out how to test if the Controller is 'Profile'. Use Smarty {debug}.

    There was an error rendering this rich post.

  • x00x00 MVP
    edited August 2013

    no it is nothing to do with that. ATM the guest module is added to panel, he want to remove it. However the guest module shouldn't be added to a profile page anyway (unless he is talking about some custom page)

    We need your version, what theme it is based on and what other addons are installed.

    For all we know this is a completely different software

    it is possible that the theme has added module the naive smarty way, but this is not how I would recommend adding modules to panel.

    grep is your friend.

  • I'm using "CustomPages" for the page system on my forums, I am also using Vanilla Bootstrap for the theme.

    If I need to provide anything else, please tell me what I need and maybe give me a few pointers on how to retrieve it, thanks for the help so far guys!

  • edited August 2013

    The guest module shows up by default for logged out users in the profile controller and the default view. You can hide it with CSS rules targeting specific body classes. You can also unset the guest module through a hook, but we need to know what version of Vanilla you're using if the CSS method doesn't do the job. Also, when you say you want it to show up only on the forums, do you mean the discussion indexes and also on the page for the individual discussion?

    Additionally, your last screenshot brings forth confusion in that it shows that you are logged in and you said that's how it's meant to look while the problem is about the guest module, which doesn't show up while you're logged in.

    Add Pages to Vanilla with the Basic Pages app

  • @Shadowdare said:
    but we need to know what version of Vanilla you're using if the CSS method doesn't do the job

    Assume 2.1 or higher, because the Bootstrap theme requires 2.1 at least.

    There was an error rendering this rich post.

  • x00x00 MVP
    edited August 2013

    Yes that explains it the PluignController which is used for the page, therefore it inherits the standard menus. If you simply wan the remove the panel you can use

    unset($Sender->Assets['Panel']);
    

    before

    $Sender->MasterView = $MasterView;
    $Sender->Render($Path.$Page.'.php');
    

    in the custom pages default.php

    If you want your custom pages to inherit the profile panel and you only want these pages to be profile pages you could change in the custom pages default.php

    public function PluginController_Page_Create(&$Sender) {
    

    to

    public function ProfileController_Page_Create($Sender) {
    

    note you need to remove all & from every (&$Sender) as this is not needed in modern version of PHP and was included naively.

    You would need to then change all reference to plugin/page and make it profile/page

    then you need to change your reference links to point to the right url.

    I would completely rename the pluign since you are making a fork. You can change the plugin folder name change $PluginInfo['CustomPages'] to match the folder name, and change the $PluginInfo to suit, also change the class name CustomPagesPlugin.

    If you want a link to be in the profile tabs you can add in default.php

    $Sender->SetTabView('CustomPage', $Path.$Page.'.php', 'Profile', 'Dashboard');
    

    before

    $Sender->MasterView = $MasterView;
    $Sender->Render($Path.$Page.'.php');
    

    then add

    public function ProfileController_AddProfileTabs_Handler($Sender) {
      $Pages = glob(dirname(__FILE__).DS.'pages'.DS.'*.php');
      foreach($Pages As $Page){
        $PageName = ucwords(str_replace('-',' ' $Page));
        $Sender->AddProfileTab('CustomPage', '/profile/page/'.strtolower($Page), 'CustomPage', T('CustomPage.'.$PageName ,$PageName ));
      }
    }
    

    just after

    class CustomPagesPlugin implements Gdn_IPlugin {
    

    if you page is named like this some-page.php the tab label will be 'Some Page'

    grep is your friend.

  • Okay thanks, I'll try this after I've got my fight back home.

    I'll get back to you, thanks.

  • I've managed to edit it so it's this:

        unset($Sender->Assets['Panel']);
        $Sender->MasterView = $MasterView;
      $Sender->Render($Path.$Page.'.php');
    

    The bar still does not disappear, have I done this incorrectly?

  • Note, the profile is a modified version of the original Vanilla profile page and is not made in CustomPages.

  • @DansTooGood said:
    Note, the profile is a modified version of the original Vanilla profile page and is not made in CustomPages.

    I think this is where you have gone wrong. How have you modified this page? I presume you are talking about a view?

    grep is your friend.

  • Yes, I think I modified it in the view, I believe the directory contained view.

  • x00x00 MVP
    edited August 2013

    first if you are going to modify core views, copy them over to your theme's view folder that way they won't get overwritten when you update.

    Secondly you would have to use themehooks to remove the panel. If you are creating a completely new page, you might as well approach it that way.

    grep is your friend.

  • Note to self : tag = theme-hooks and the file to alter is class.[themenameinlowercase]themehooks.php The classname for the themehooks class is _themenameinCamelCase_Themehooks If you look in about.php you can see the theme name to use : $ThemeInfo['ThemeName']. It will hide the asset, but the HTML surrounding the asset will not be hidden. I need the extra '3 columns' so I cannot manipulate with CSS.

    Sorry for breaking into the thread.

    There was an error rendering this rich post.

  • I removed some "AddSideMenu" PHP thing which seemed to fix it, thank for the help guys.

  • @DansTooGood said:
    I removed some "AddSideMenu" PHP thing which seemed to fix it, thank for the help guys.

    How? If you removed it from the core your doing it wrong. Unless of course you are making a fork, then you maintain that, and are responsible for supporting it.

    grep is your friend.

Sign In or Register to comment.