We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    I have been reviewing the following: http://www.muddydogpaws.com/development/wayfinder/parameters.html

    ...but have not been able to find what I am looking for. Maybe it’s not even an option!?

    Can Wayfinder work with "Unpublished" documents? It doesn’t appear so....Hmm, does a parameter to override filtering of unpublished docs exist, similar to Ditto’s?

      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 23491 ☆ A M B ☆
      • 1,056 Posts
      Update:

      For those looking to use Wayfinder 2.0 with Unpublished Documents, here is a preliminary patch that seems to do the trick. Please note, this has not been tested in more advanced, deeply nested list situations. It simply introduces the hideUnpublished parameter. If defined w/ a value of 0, Wayfinder will include unpublished documents from the current branch within the result set.

      2 simple patches:

      Edit assets/snippets/wayfinder/wayfinder.inc.php: (Line 351)

      1. Replace:
      $sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
      

      With:
      			// pixelchutes - Work with unpublished documents  - 6:19 PM 8/25/2007
      			$sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published<>".( $this->_config['hideUnpublished'] ? 0 : 2 )." AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
      			//$sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
      


      2. Edit Wayfinder snippet: (v2.0/MODx v0.9.6 - Line 61)

      Add the following new parameter to Line 61
          'hideUnpublished' => isset($hideUnpublished) ? $hideUnpublished: TRUE, // pixelchutes - work with unpublished documents
      


      That’s it!

      Simply pass hideUnpublished in your Wayfinder snippet call:
      [[Wayfinder? &hideUnpublished=`0` &startId=`[*id*]`]]
      

      with your snippet call to include Unpublished Documents with Wayfinder!

      * Further testing in more advanced scenarios should take place to confirm desired functionality
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 6726
        • 7,075 Posts
        Exactly what I was looking for !
        Works as advertised, thanks !

        It would be nice if it made it into the next wayfinder release...

          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 7231
          • 4,205 Posts
          Interesting that this is such an ’old’ post. I have seen requests for this often and never knew that there was a posted solution.

          Bookmarked now for future reference rolleyes
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 6726
            • 7,075 Posts
            Neither did I until I had to find a solution for this and Google brought me here...
            I am amazed to see how old the post was (missed it) and how little feedback there was...
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 3749
              • 24,544 Posts
              Could you guys satisfy my curiosity about why you would want Wayfinder to work with unpublished docs?

              Bob
                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
                • 10449
                • 956 Posts
                Yep, I’m curious as well. If it’s just for previewing new pages, wouldn’t it be easier to just use doc-groups + user-groups?
                  • 6726
                  • 7,075 Posts
                  You’re right it’s for previewing pages, and yes I have been using doc groups and user groups in the past but on this one, I had to duplicate the entire tree for a website which is undergoing a total re-structuring / re-writing and those pages have several doc groups and user groups tied to them. It was easier in my opinion to keep those unpublished...
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 23491 ☆ A M B ☆
                    • 1,056 Posts
                    Quote from: BobRay at Mar 02, 2008, 04:13 PM

                    Could you guys satisfy my curiosity about why you would want Wayfinder to work with unpublished docs?

                    Bob


                    I thought it had something to do with trying to use &includeDocs=`123` where doc_id 123’s parent was an unpublished container...However, I tried a few different scenarios/test cases and that doesn’t seem to be the case. I couldn’t find a valid scenario that justified how this parameter might be leveraged, however I do like the idea of optionally using it temporarily during development, however.

                    Honestly, it’s been awhile and now I can’t even remember! Glad to see it managed to help someone smiley
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                      • 3749
                      • 24,544 Posts
                      What confuses me is that if you use it during development, it seems visitors to the site would see the unpublished documents, so why not just publish them?

                      Bob
                        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