On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I have the following case:

    There are a few productpages on my website (no use of ditto). My client wants to place pdf’s on those pages that can be downloaded by people who are logged in. I know it’s possible to see hidden pages after login, but i can’t figure out if it’s also possible to hide elements on pages that are also visible to everyone.

    So when you go to page product 1, you can’t see the pdf.

    When you log in, you go to page product 1 and you can see the pdf.

    PS. is it also possible to show your last login date after you have logged in?
    • You probably can use the personalize snippet http://modxcms.com/extras.html?view=package/view&repository=10&package=336
      • Yes i’m already using that, but i can only hide a complete page and not just 1 element (in example pdf for download) on a page. Does anyone know a solution for that?
        • Try this:

          Create a Template Variable to hold the pdf image link, make sure you assign it to the template you are using.

          Create a snippet with this code and call it on the page where you want the pdf link to appear, changing "Name_of_your_TV" to match the one you created.
          <?php
          $output ="";
          if(isset($_SESSION[’webInternalKey’])){
          $output .="[*Name_of_your_TV*]";
          }
          return $output;
          ?>

          hope this helps smiley
            xforum
            http://frsbuilders.net (under construction) forum for evolution
          • MODx equals Many Options Doing X cool

            The PHx Plugin:
            [+phx:mo=`myWebgroup`:then=`[*tv*]`:else=``+]
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • Quote from: Breezer at Apr 07, 2009, 05:15 PM

              Try this:

              Create a Template Variable to hold the pdf image link, make sure you assign it to the template you are using.

              Create a snippet with this code and call it on the page where you want the pdf link to appear, changing "Name_of_your_TV" to match the one you created.
              <?php
              $output ="";
              if(isset($_SESSION[’webInternalKey’])){
              $output .="[*Name_of_your_TV*]";
              }
              return $output;
              ?>

              hope this helps smiley

              Too bad, that isn’t working..:( Seems logical, but now modx shows the tv also when you’re not logged in...

              Quote from: mrhaw at Apr 07, 2009, 05:31 PM

              MODx equals Many Options Doing X cool

              The PHx Plugin:
              [+phx:mo=`myWebgroup`:then=`[*tv*]`:else=``+]


              I’ve installed the plugin and copied the code, but it doesn’t do anything...
              • Breezers snippet works for me, log in as a web user! On the PHx you will need to set your webgroup name...
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • Try calling the snippet uncached on the page :

                  [!My_PDF_snippet!]

                  Also make sure you don’t add the TV itself to the template or page content, just make sure it is assigned to the template you use. The snippet you created needs to be placed where you want the pdf link to appear on the page.

                  Snippets are also spelling and case sensitive, so make sure the call matches what you named it in the manager.

                  example: (added to template)
                  <html>
                  .../
                  <body>
                  
                    [*content*]
                   [!My_PDF_snippet!]
                  
                  </body>
                  </html>

                    xforum
                    http://frsbuilders.net (under construction) forum for evolution
                  • Thnx Breezer, it works when i call the snippet uncached! So if anyone wants to do this trick in the future, follow the next steps:

                    1. Put this code in your template: [!My_PDF_snippet!]

                    2. Create a snippet with this code:

                    <?php
                    $output ="";
                    if(isset($_SESSION[’webInternalKey’])){
                    $output .="[*Name_of_your_TV*]";
                    }
                    return $output;
                    ?>

                    3. Create a TV called "Name_of_your_TV" that show’s your pdf files and assign this to the template you want.

                    Now you can edit a page, on the bottom of the editor you’ll find an option to upload your files.