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

Tip: Showing Pockets to guest (for specific pocket locations) in vanilla 2.1

one way to only present pockets to guests in Vanilla 2.1 with pockets 1.1.2

in vanilla 2.1

in plugins/Pockets/class.pockets.plugin.php around line 324

         from

         public function ProcessPockets($Sender, $Location, $CountHint = NULL) {
          if (Gdn::Controller()->Data('_NoMessages'))
             return;




           public function ProcessPockets($Sender, $Location, $CountHint = NULL) {
              // possible locations "Head", "Foot", "Content", "BetweenDiscussions", "BetweenComments"

              $blockit = NULL;  // initialize

            // examples  location specific

             // block  only pockets in  "Content" or  "BetweenDiscussions",
            //  if (($Location == "Content") ||($Location == "BetweenDiscussions")) {
            //      $blockit = TRUE;
             // }

            //  only block non Content Pockets
            // if ($Location != "Content")  {
             // $blockit = TRUE;
             // }

             // only block  Content Pockets
             // if ($Location == "Content")  {
             // $blockit = TRUE;
             // }

            $blockit = TRUE;  // block all locations 

            // block specified location selected above if Guest user
             if((Gdn::Session()->UserID < 1) && $blockit)  {
             return;
              }

              if (Gdn::Controller()->Data('_NoMessages'))
                 return;

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • AnonymooseAnonymoose ✭✭
    edited August 2014

    http://blog.vanillaforums.com/help/power-pockets-adding-custom-html-js-vanilla-forum/#more-6244

    Claims that adding a conditional to a Pocket can be done intheme:

    Adding a conditional so Pocket shown only to a user who is SignedIn
    {if $User.SignedIn}
    {pocket name="foo"}
    {/if}
    
    Adding a conditional so Pocket shown only to users not SignedIn
    {if !$User.SignedIn}
    {pocket name="foo"}
    {/if}
    
  • nice Anonymoose. Would have missed that entirely, it was posted on blog after this discussion post.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • AdrianAdrian MVP
    edited August 2014

    @Anonymoose‌ thanks for sharing that here. I recommend tpl file based-theme's as you can have lots of fun with Pockets. By the way, make sure if you call pockets in theme you do not enable. This video I put out has tips for pockets and themes (for hosted) but it should also apply to Open Source:
    https://youtube.com/watch?v=xwZR85x9crc

Sign In or Register to comment.