We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16501
    • 28 Posts
    Is it possible to use ditto (or an alternative) to retrieve a list of documents that a manager user has access to?

    I’d like to present a page to the user after they’ve logged in with a list of the pages they manage and associated data (last modified etc).

    Any ideas welcome.
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      &hidePrivate is set On by default.
      Just make sure you give the right access group to the right document group.

      Or, is this related with menu?
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 25663 MODX Staff
        • 12,272 Posts
        Right now I don’t think you’ll find a solution that meets your needs or adequately covers all bases. Without versioning you’d not be able to see documents they edited previously, but others had come behind and edited since.

        However and with that being said, check out the Manager welcome page, Recent Resources tab, for a solution that works with those constraints in mind right now.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 16501
          • 28 Posts
          If anyone is interested here’s what I came up with...

          <?php
          $groups = $modx->db->select("name, documentgroup", "`modx_member_groups` as g INNER JOIN `modx_membergroup_names` as n ON g.user_group = n.id INNER JOIN modx_membergroup_access as a ON g.user_group = a.membergroup", "g.member = ".$_SESSION['mgrInternalKey'], "n.name");
          	$numgroups = mysql_numrows($groups); 
          	$i = 0;
          
          	while($i < $numgroups) {
          	
          		$docgroup = mysql_result($groups,$i,"documentgroup");
          		$name = mysql_result($groups,$i,"name");
          		$documents = $modx->db->select("document, pagetitle", "modx_document_groups INNER JOIN modx_site_content ON document = modx_site_content.id", "document_group = ".$docgroup);
          		$numdocuments = mysql_numrows($documents);
          		echo $name . '<ul>';
          	
          		$x = 0;
          	
          		while ($x < $numdocuments) {
          		
          			$docid = mysql_result($documents,$x,"document");
          			$title = mysql_result($documents,$x,"pagetitle");
          			echo '<li><a href="[~'.$docid.'~]">'.$title.'</a></li>';
          			
          			$x++;
          			
          		}
          		echo '</ul>';
          
          		$i++;
          	}
          ?>
          


          As it says on the box, just outputs a list of all the pages the logged in manager has access to grouped by document group.

          There’s no error checking, so it will throw a parse error if you’re not logged in, however I’m using this as part of a ManagerLogin tpl, so it only shows when the manager is logged in.

          Enjoy.
            • 26931
            • 2,314 Posts
            thanks for sharing!
            As it says on the box, just outputs a list of all the pages the logged in manager has access to grouped by document group.
            There’s no error checking, so it will throw a parse error if you’re not logged in, however I’m using this as part of a ManagerLogin tpl, so it only shows when the manager is logged in
            clicking on those links will open the document (ready to edit)?
              • 26931
              • 2,314 Posts
              however I’m using this as part of a ManagerLogin tpl, so it only shows when the manager is logged in.
              these threads could be interesting for you:
              "Customized Manager"
              SystemEvents:
              OnManagerWelcomePrerender -> before the content
              OnManagerWelcomeHome -> in the home tab
              OnManagerWelcomeRender -> after the content
              http://modxcms.com/forums/index.php/topic,43572.msg260167.html#msg260167
              http://modxcms.com/forums/index.php/topic,37321.msg225741.html#msg225741
                • 20413
                • 2,877 Posts
                Coool!
                Just add the manager action TO a href="...[~’.$docid.’~]...

                See this http://modxcms.com/forums/index.php/topic,43572.msg260167.html#msg260167
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 26931
                  • 2,314 Posts
                  Just add the manager action TO a href="...[~’.$docid.’~]...
                  ah, sure...i tottally need to play with this smiley
                  echo '<li><a href="[~'.$docid.'~]?a=27">'.$title.'</a></li>';
                    • 16501
                    • 28 Posts
                    Thanks for all your suggestions. I’m very proud of myself, I just made my first plugin grin

                    Create a new plugin add the OnManagerWelcomeHome event and here’s the code

                    // <?php
                    
                    $e = &$modx->Event;
                    $output ='';
                    
                    switch($e->name) {
                        case 'OnManagerWelcomeHome':
                            $groups = $modx->db->select("name, documentgroup", "`modx_member_groups` as g INNER JOIN `modx_membergroup_names` as n ON g.user_group = n.id INNER JOIN modx_membergroup_access as a ON g.user_group = a.membergroup", "g.member = ".$_SESSION['mgrInternalKey'], "n.name");
                    	$numgroups = mysql_numrows($groups); 
                    	$i = 0;
                    
                    	while($i < $numgroups) {
                    	
                    		$docgroup = mysql_result($groups,$i,"documentgroup");
                    		$name = mysql_result($groups,$i,"name");
                    		$documents = $modx->db->select("document, pagetitle", "modx_document_groups INNER JOIN modx_site_content ON document = modx_site_content.id", "document_group = ".$docgroup);
                    		$numdocuments = mysql_numrows($documents);
                    		$output = $output . $name . '<ul>';
                    	
                    		$x = 0;
                    	
                    		while ($x < $numdocuments) {
                    		
                    			$docid = mysql_result($documents,$x,"document");
                    			$title = mysql_result($documents,$x,"pagetitle");
                    		        $output = $output .  '<li><a href="index.php?a=27&id='.$docid.'">'.$title.'</a></li>';
                    			
                    			$x++;
                    			
                    		}
                    		$output = $output .  '</ul>';
                    
                    		$i++;
                    	}
                        break;
                        default:
                            $output = '';
                        break; 
                    }
                        
                    $e->output($output);
                    
                    return;
                    
                      • 20413
                      • 2,877 Posts
                      Thanks for sharing it!! cool
                        @hawproductions | http://mrhaw.com/

                        Infograph: MODX Advanced Install in 7 steps:
                        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower