We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2132
    • 3 Posts
    First post to the forums. I’m rather new to modx and there’s a lot of stuff i’m still rather unsure about, but i’ve searched trough the documentation, wiki, forum, google etc and just can’t seem to find a solution to this particular matter, so here goes nothing:

    I’m trying to set up blog/news front-end posting and editing for web users using Ditto to show the news items/blog entries in the front page and Front End Document Manager (FDM) to show editing tools for each item if the user has permissions to modify them. this works fine, except for publishing/unpublishing documents. i can get ditto to show unpublished pages with &showPublishedOnly=`0` and fdm gives admins the ability to pub/unpub them, but the problem is that ditto shows the unpublished pages to everyone, logged-in or not. i’d only want blog admins to see the unpublished pages and as i’d rather not separate the editing tools to a separate "admin page" or such, this is a problem.

    so: how could i get get ditto to show unpublished pages only to users belonging to a certain user group (eg. blog admins)? or if not, some other workaround for this?

    just in case it helps: these are what i’m using:
    MODx 0.9.6.1B
    Ditto 2.1.0
    Front End Document Manager (FDM) v0.1b


    i guess one workaround would be to get FDM to change the documents access permissions to a certain document group whenever it’s published/unpublished through the front-end ui, but it doesn’t seem to have an option ready for this, and as i’m not so good with php and still pretty unfamiliar with modx, i have no idea how to archieve this.

    also, the (bit confusing) usage instructions of the showPublishedOnly parameter in ditto 2.1.0 snippet code suggests that it could show ONLY unpublished pages (see below) which could work as a workaround, but i guess this is just a typo in the instructions or something? or at least it seems that 0 shows both published & unpublished and 1 only published (as would seem logical to me)

    Quote from: snippet.ditto.php

    <br />Param: showPublishedOnly<br />Purpose: Show only published documents<br /><br />Options:<br />        0 - show only unpublished documents<br />        1 - show both published and unpublished documents<br /><br />Default:<br />        1 - show only published documents<br />

      • 2132
      • 3 Posts
      and as i suspected, i found a workaround by myself immediately after posting the question here, in case it helps some other newbie, here it is:

      i made 2 chuncks with the ditto call in them:
      admin_ditto: 
      [!Ditto? &parents=`3` &tpl=`DittoTpl` &showPublishedOnly=`0`!]

      default_ditto: 
      [!Ditto? &parents=`3` &tpl=`DittoTpl`!]


      i updated the membercheck snippet to 1.1 which has the &default option in it, and i call the chuncks with the following call:

      [[MemberCheck? &groups=`blog editors` &chunk=`admin_ditto` &default=`default_ditto`]]


      this way the ditto call in admin_ditto-chunk is shown to blog editors and everyone else sees the call in default_ditto, which is exactly the same except it doesn´t show unpublished entries.

      it’s not pretty, but it works. though would be nice to get ditto separate the unpublished entries somehow anyway, for stuff like making them visually different from the rest of the entries etc.
        • 36416
        • 589 Posts
        Quote from: aropupu at Feb 26, 2008, 03:45 AM

        it’s not pretty, but it works. though would be nice to get ditto separate the unpublished entries somehow anyway, for stuff like making them visually different from the rest of the entries etc.

        It’s OK workaround if you really need to mix editing and displaying interfaces like that.
        I prefer entirely different "editor area" of the website, with webuser login and useful info for a given editing operations in the sidebar.