We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26931
    • 2,314 Posts
    hi there,

    i use this call to retrieve one random image from galleries within folder ID4:
    [!MaxiGallery? &gal_query_ids=`4` &query_level_limit=`2` &limit=`1`  &order_by=`random` &display=`normal` &galleryPictureTpl=`MGthumbsRand`&galleryOuterTpl=`MGouterRand`&clearerTpl=`MGclearer` &css=``  !]

    but it also retrieves thumbnails from galleries that have been set to unpublished ... is there a parameter/way to ignore unpublished ressources?

    thanks, j
      • 7923
      • 4,213 Posts
      Hmm.. it should not show pictures from unpublished documents by default.. Have you tried to log off and see it then? If the unpublished comes only when logged to manager.. can’t remember how it goes.. But I know that it shouldn’t display pictures from unpublished child documents by default.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 26931
        • 2,314 Posts
        Have you tried to log off and see it then? If the unpublished comes only when logged to manager
        Hi doze,
        yes i tried that ... still grabbing images from unpublished galleries

        MODx Evolution 1.0.2 // MaxiGallery 0.6

        this is my MGthumbsRand Chunk:

        		<a class="MGthumb" href="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" rel="lightbox" title="[+maxigallery.picture.title:htmlent+]">
        		<img class="MGimg image" src="[+phx:input=`[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]`:phpthumb=`&w=110&h=110&zc=1&q=95`+]" title="[+maxigallery.picture.title:htmlent+]" alt="Random Image [+maxigallery.picture.title:htmlent+]" />
        		</a>
          • 7923
          • 4,213 Posts
          I guess the function doesn’t work anymore then..

          In maxigallery class file there is a function that is taken from some Ditto version that get’s the child documents. You could check that if you want to debug it.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 26931
            • 2,314 Posts
            thanks doze

            i’ll have a look at the class file
              • 4172
              • 5,888 Posts
              Hi Jan,

              you can try to change this line (about line 890) in maxigallery.php

              <?php
              
              //retrieve pics by gallery id's (query mode)
              $rs=$modx->db->select("*", $modx->db->config['table_prefix'].$mg->mgconfig['gtable'], "(gal_id IN ('" . implode("','", $mg->mgconfig['gal_query_ids']) . "') AND NOT hide='1')",$orderby.' '.$mg->mgconfig['order_direction'], $mg->mgconfig['offset'].','.$mg->mgconfig['limit']);


              to:

              <?php
              
              //retrieve pics by gallery id's (query mode)
              
              $query='select mg.* from '.$modx->db->config['table_prefix'].$mg->mgconfig['gtable'].' mg ';
              $query.='left join '.$modx->getFullTablename('site_content').' sc on sc.id = mg.gal_id';
              $query.=" WHERE (gal_id IN ('" . implode("','", $mg->mgconfig['gal_query_ids']) . "') AND NOT hide='1')";
              $query.=' AND sc.published=1 ';
              $query.=' ORDER BY '.$orderby.' '.$mg->mgconfig['order_direction'];
              $query.=' LIMIT '.$mg->mgconfig['offset'].','.$mg->mgconfig['limit'];
              $rs=$modx->db->query($query);
              


              may be there are some bugs. I did not test it!


                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 26931
                • 2,314 Posts
                thanks Bruno! i’ll try it and report back