• Wayfinder and Unpublished Docs?#

  • pixelchutes Reply #1, 4 years, 5 months ago

    Reply
    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?



  • pixelchutes Reply #2, 4 years, 5 months ago

    Reply
    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


  • davidm Reply #3, 3 years, 11 months ago

    Reply
    Exactly what I was looking for !
    Works as advertised, thanks !

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



  • dev_cw Reply #4, 3 years, 11 months ago

    Reply
    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


  • davidm Reply #5, 3 years, 11 months ago

    Reply
    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...


  • BobRay Reply #6, 3 years, 11 months ago

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

    Bob


  • ganeshXL Reply #7, 3 years, 11 months ago

    Reply
    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?


  • davidm Reply #8, 3 years, 11 months ago

    Reply
    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...


  • pixelchutes Reply #9, 3 years, 11 months ago

    Reply
    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


  • BobRay Reply #10, 3 years, 11 months ago

    Reply
    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