HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Pockets - currently no way to lock down to Members Only

I use Pockets, great little feature apart from one thing.

There is no way to assign a particular pocket to a Group, like Members or Moderators.

Some things I have in mind I do not want guests to view.

In the Pockets editor/config, there is no way to lock that down.

Is there a workaround that we can insert in the code?

Tagged:

Comments

  • BleistivtBleistivt Moderator

    You could either use messages (dashboard/message) for that and display those messages in a restricted category only, or display the pocket for signed in users only through your theme .tpl:

    {if $User.SignedIn}

    {pocket name="foo"}

    {/if}

    See https://blog.vanillaforums.com/product/power-pockets-adding-custom-html-js-vanilla-forum

  • manticore789manticore789 Down Under New

    @Bleistivt thank you very much for the guidance. I got it working. This is what I did, leaving a trail for others to do similarly.

    1) Right, I use Pockets, that much is a given.

    2) On my website, I use a small paid ChatBox/Shoutbox solution which I have displayed in the right side panel. This is because there is no native Vanilla solution anymore.

    3) I use the Bootstrap theme, Darkly option.

    My goal: to make the ChatBox only visible to signed-in members, and not to Guests nor Applicants. It still needs to be visible in the right-side panel, but disappear when members sign out.

    Steps to remediate:

    1) Find the code to use:

    {if $User.SignedIn}
    {pocket name="Cbox"}
    {/if}
    

    2) The theme tpl to use. In my case:

    themes/Bootstrap/views/default-master.tpl
    

    3) The Pocket (Cbox) was already created (mostly an iframe driven piece of code). The key is to set it to Custom (not panel). Custom will allow the Pocket to appear/disappear, while if set to Panel, it will be fixed, which is not what we want.

    With that information in place, we needed to insert the code into the appropriate part of the tpl file, namely the right-side panel called <aside class="page-sidebar". This was the area in my template to be changed:

    <aside class="page-sidebar" role="complementary">
         {asset name="Panel"}
        {if $User.SignedIn}
    {pocket name="Cbox"}
    {/if}
        </aside>
    

    What this conditional will do is display the Cbox Pocket when users are signed in, and switch it off when guests only.

    Obviously this config can be used for many usages.

    Despite some pokery and jiggery I got it to work, though I feel the initial documentation which goes back some years did more to confuse rather than clarify.

    Oh, and there appears to be a glaring error in the doco on one piece of code which should be corrected.

    Thanks again.



     
Sign In or Register to comment.