Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Collin 42 posts 62 karma points
    Aug 16, 2011 @ 09:25
    Collin
    0

    Pulling unpublished content?

    I'm wondering if it's possible to adapt this query so that it pulls unpublished content?

    <xsl:for-each select="$currentPage/*/* [@isDoc]">

     

    (I suspect this isn't possible, but I just want to check this before I write a macro that does this for me)

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Aug 16, 2011 @ 09:38
    Chriztian Steinmeier
    0

    Hi Colin - you're right, you have no access to unpublished content from XSLT without using some sort of extension function (can't help you with one, either)

    /Chriztian

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 16, 2011 @ 10:10
    Lee Kelleher
    0

    Hi Colin,

    Following up on Chriztian's comment, the unpublished content is not written to the XML cache - hence why it isn't available to you in XSLT.

    My thinking is that you might need to re-think your solution ... why do you want to list unpublished documents/nodes?

    If it's a case of just hiding them from various parts of the front-end, e.g. navigation, news listings, etc. Then you could make use of the "umbracoNaviHide" property in your doc-types?  (We can explain more if you think that's a good approach?)

    Cheers, Lee.

  • Collin 42 posts 62 karma points
    Aug 16, 2011 @ 10:37
    Collin
    0

    Sorry for being unclear on my intentions with the code, it has to do with the fact that I do not want to unintentionally release information I shouldn't.

    However I can describe the intended functionality as follows:

    1. There are members that can register on a site
    2. Each of these members has a page on the site where they can publish information
    3. They can add certain 'subjects' to these pages, and only subjects they have filled in and/or are approved are shown
    4. All information members submit are held for moderation and have the state unpublished
    5. Admins (moderators) check and can preview this information before publication

    The member pages and subjects are custom document types (due to the requirements and they are not included in any menu). Subjects are children of the member page.

    For the member pages we have a template that displays all the information. And uses a generated menu that uses javascript to switch the content if you select a subject (this data is prefilled, so no refresh or new request).

    The problem arises when admins preview this content. As a preview of a member page will not show the different added subjects if they are not published. I'm trying to figure out a good way to allow a preview to include and display these unpublished subjects.

    My current idea for solving this is the following:

    1. Adapt the macro that it uses the umbraco api to pull in the content and display it if it is published (so no longer use XSLT for pulling in the data)
    2. Add logic that if the member page is in preview mode the member page displays published and unpublished subjects.

    I hope this makes sense.

  • skiltz 501 posts 701 karma points
    Aug 16, 2011 @ 12:21
    skiltz
    0

    Why not have a property somewhere called "Approved" then in your XSLT just show nodes which have been approved?

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Aug 16, 2011 @ 12:44
    Dan Diplo
    0

    If you really need to access unpublished documents then you could go use the Umbraco Document API  This should give you programmatic access to unpublished nodes. Look at the umbraco.cms.businesslogic.web.Document class. Your best bet would be to do this via Razor macros, but if not then you'd need to write some XSLT exctensions to do this.

    But I'd consider first whether you really need to do this? You could hide nodes (and protect them from acess by adding them to a member group or something).

Please Sign in or register to post replies

Write your reply to:

Draft