MyBBHacks.com Plugins for  MyBB
Working Module for ProPortal - Printable Version

+- MyBBHacks.com Plugins for MyBB (https://www.mybbhacks.com)
+-- Forum: ezGallery Pro for MyBB (https://www.mybbhacks.com/forumdisplay.php?fid=8)
+--- Forum: Feature Requests (https://www.mybbhacks.com/forumdisplay.php?fid=11)
+--- Thread: Working Module for ProPortal (/showthread.php?tid=3164)



Working Module for ProPortal - Cobalt60 - 09-12-2019

Hi,
does someone have a working Module for ProPortal to display a random ezGPro image?
Or knows a way to put a random image in an announcement?

I would like to present one (big) random image on entering the site.

Thanks!


RE: Working Module for ProPortal - MyBBHacks - 09-12-2019

Can you enter in php code?


RE: Working Module for ProPortal - Cobalt60 - 09-12-2019

Yes, that will work


RE: Working Module for ProPortal - MyBBHacks - 09-12-2019

Untested but maybe try
Code:
global $mybb, $db;

    $groupsdata = $mybb->user['usergroup'];


        $wherestats = "
        LEFT JOIN ".TABLE_PREFIX."users AS m  ON (m.uid = p.ID_MEMBER)
        LEFT JOIN ".TABLE_PREFIX."usergroups AS mg ON (m.usergroup = mg.gid)
        LEFT JOIN ".TABLE_PREFIX."gallery_usersettings AS s ON (s.ID_MEMBER = m.uid)
        LEFT JOIN ".TABLE_PREFIX."gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $mybb->user['uid'] . " AND v.user_id_cat = p.USER_ID_CAT)
        LEFT JOIN ".TABLE_PREFIX."gallery_catperm AS c ON (c.id_group IN ($groupsdata) AND c.id_cat = p.id_cat)
        WHERE ((s.private =0 || s.private IS NULL ) AND (s.password = '' || s.password IS NULL ) AND p.USER_ID_CAT !=0 AND p.approved =1)  || (p.approved = 1 AND p.user_id_cat = 0 AND (c.view IS NULL || c.view = 1)) ";


        
        
            $result = $db->query("
            SELECT
                p.ID_PICTURE, p.commenttotal, p.totalratings, p.rating, p.filesize,
                p.views, p.thumbfilename, p.title, p.ID_MEMBER, m.username, mg.namestyle,p.date,
                p.description, p.mature, v.ID_PICTURE as unread
            FROM ".TABLE_PREFIX."gallery_pic as p

            $wherestats GROUP BY p.ID_PICTURE
             ORDER BY RAND()
            LIMIT 1"
             );

             $context['picture_list'] = array();
                 while($row = $db->fetch_array($result))
                {
                    $context['picture_list'][] = $row;
                }
            $db->free_result($result);
    foreach ($context['picture_list'] as $row)
    {

            echo '<a href="' . $mybb->settings['bburl'] . '/ezgallery.php?sa=view&id=', $row['ID_PICTURE'], '"><img src="', $mybb->settings['bburl'] . '/gallery/', $row['thumbfilename'], '" alt="" /></a><br />';
            
            
    }



RE: Working Module for ProPortal - Cobalt60 - 09-12-2019

Cool - principally working ... now I only have to find a away to fill the width on the "container" the code snippet is in - so the full image resized no the thumb Smile

Thanks!


RE: Working Module for ProPortal - MyBBHacks - 09-12-2019

Nice! You can add p.filename to the sql.
That use that variable instead on the display to show full size image.


RE: Working Module for ProPortal - Cobalt60 - 09-12-2019

Great! Thanks again!