We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18961 ☆ A M B ☆
    • 237 Posts
    I'll do my best to try to explain what I need to do and hopefully someone will have an answer for me. Keep in mind that I can use either Evolution or Revolution - whichever one will allow me to do what I need to do.

    So, here we go...

    I need to have pages in my site that everyone one can, however, I need to link pdf files, dwg files, etc. to those page using template variables. However, we only want specific web users to see the template variables. In other words, if you have a web login as an architect, when you go to those pages and are logged in you will see a list of links to the files that I mentioned above. If you are not logged in, you see everything on the page except the template variables.

    I hope this makes sense and that there is a way to do this. Again, Evo or Revo, as long as I can make this work.

    I would really appreciate some help with this, even if I need to hire someone to do some custom programming to make it work.

    Thanks in advance....
      Michael Smull
      http://www.bigpixelstudio.com
      twitter: @mdsdesign
      • 3749
      • 24,544 Posts
      There are a number of different ways to do what you're describing.

      I think the easiest would be to use output modifiers in the TV tag.
      (or PHX if you're using Evolution). I'm posting from my phone, so I'll check back later and give an example.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4041
        • 788 Posts
        If using Evolution and checking a valid weblogin session, using a snippet like this would be easiest in my opinion:

        [!Show_Logged_TVs!]

        <?php
        $output ="";
        
        if(isset($_SESSION['webValid'])){
            
            $output .="<p>[*TV_name*]</p>";
        
        return $output;
        }
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 3749
          • 24,544 Posts
          As I said, you could do it with output modifiers, but In Revolution, I would actually use a snippet like this:
          [[!ShowTvToGroup? &tv='MyTv'  &group='architects']]


          <?php
          /* ShowTvToGroup Snippet */
          
          $output = "";
          
          if ($modx->user->isMember($scriptProperties['group']) ) {
              $output = $modx->resource->getTVValue($scriptProperties['tv']);
          }
          return $output;

          The snippet will show any specific TV to any specific group and nothing to everyone else.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 18961 ☆ A M B ☆
            • 237 Posts
            I want to thank both of you for responding to this question. It was posted so I could put a proposal together for a client and I wanted to make sure that I could use ModX. With your answers I realized that I could and we are now building the site. We ended up using ModX Evo for the project and what I need to have happen is as follows:

            When a Web User with the web access permissions to user group Architect logs in I need them to be able to see the Template Variable called: documents on all pages that it shows up. Only the architects should be able to see the documents. Anyone else should see just the regular Page Title, Content, etc.

            So, Breezer, it looks like I would use your solution. I'm just not exactly sure what I replace. I'm guessing the [*TV_name*] would be documents. Do I need to change where you have 'webValid' ?

            Sorry for the questions. It is probably very simple, but I'm a designer and not a programmer. Thanks so much for your help.
              Michael Smull
              http://www.bigpixelstudio.com
              twitter: @mdsdesign
              • 18961 ☆ A M B ☆
              • 237 Posts
              Bob, this is exactly what I want to do, except in Evolution. I'm trying to attempt what Breezer wrote, but I'm a bit lost. Do you have some advice for Evo?
                Michael Smull
                http://www.bigpixelstudio.com
                twitter: @mdsdesign
                • 4041
                • 788 Posts
                Give this a try and see if it works for you - pass the snippet a single tv name or a comma seperated list of tv names....a single group name or a comma seperated list of group names, then add the placeholders into your template or content where you want the tvs to show.

                code removed :)
                [ed. note: breezer last edited this post 14 years, 11 months ago.]
                  xforum
                  http://frsbuilders.net (under construction) forum for evolution
                  • 18961 ☆ A M B ☆
                  • 237 Posts
                  First of all, let me say thanks and wow. Now, let me see if I've done everything right.

                  Here is the template:

                  <strong>Model Number: [*itemnumber*]</strong>
                  <p><strong>[*pagetitle*]</strong></p>
                  [*productphoto*]
                  <p><strong>Description:</strong></p>
                  [*content*]
                  <strong>Documents & Downloads</strong>
                  [!show_specific_tvs?
                  &tvs=`documents`
                  &groups=`Architect`
                  !]
                  [+documents+]
                  


                  When logged in the documents show. However, when you are not logged in you get the following error:

                  « MODx Parse Error »
                  MODx encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »

                  PHP error debug
                  Error: Invalid argument supplied for foreach()
                  Error type/ Nr.: Warning - 2
                  File: /home/automatic/www/www/manager/includes/document.parser.class.inc.php(814) : eval()'d code
                  Line: 32

                  Parser timing
                  MySQL: 0.0076 s (3 Requests)
                  PHP: 0.0370 s
                  Total: 0.0446 s

                  So, did I miss something? This is all very new to me. Was there something else in the code I was supposed to change?

                  Again, thank you so much for such a detailed snippet and the how to.
                    Michael Smull
                    http://www.bigpixelstudio.com
                    twitter: @mdsdesign
                    • 4041
                    • 788 Posts
                    Very sorry, I fixed the code in my last post which should fix the error.

                    Hope it helps smiley
                      xforum
                      http://frsbuilders.net (under construction) forum for evolution
                      • 18961 ☆ A M B ☆
                      • 237 Posts
                      Well, no more parse errors, but it's showing the template variable when not logged in. Any thoughts? And by the way, thanks again.
                        Michael Smull
                        http://www.bigpixelstudio.com
                        twitter: @mdsdesign