• XThreads Gallery on Pro_Portal
  • Uploader:leefish
#1
REQUIRES: XThreads and Pro_Portal

This is a fairly rough version of the plugin - see it as a BETA release. I am working on adding some options to Pro_Portal so that its possible to change the block contents from the ACP rather than from inside the pro_portal block file. But for now, here it is in its first version - if I don't release a version NOW I think RocketFoot will run me down in his Mustang Smile

PLUG-IN EDITS
Base set up: Its set up to show 4 images randomly selected from forum number 2

You can change this inside the block by editing the query. The query is THIS bit. Open up the block file in your fave editor - I use Notepad++ and copy the code below from the plugin.

PHP Code:
$piccount=4;
$query $db->query
("
            SELECT a.updatetime, a.md5hash, a.uploadtime, a.aid, a.attachname, a.filename, a.thumbs, t.*
            FROM "
.TABLE_PREFIX."xtattachments a
            LEFT JOIN "
.TABLE_PREFIX."threads t ON (t.tid=a.tid)
            WHERE t.visible=1 AND a.thumbs!=' ' AND t.closed NOT LIKE 'moved|%' AND t.fid IN ('2')
            GROUP BY a.tid
            ORDER BY RAND()
     LIMIT 0, 
$piccount
"
); 

Now, if you want to define the forum ids, you do it by changing the WHERE line, like below:

PHP Code:
WHERE t.visible=AND a.thumbs!=' ' AND t.closed NOT LIKE 'moved|%' AND t.fid IN ('2','3','4'

That will now call images from forums 2,3 and 4. IMPORTANT: see how each forum ID has the ' symbol around it - and a comma between. You need to make sure you use that format or it will error.

At the moment its set to random. You can change that to ASC (ascending order) or DESC (descending order)

This is what you change to get DESCENDING ORDER:

PHP Code:
ORDER BY t.tid DESC 

or to get ASCENDING ORDER

PHP Code:
ORDER BY t.tid ASC 

Changing the number of pictures is done so:
PHP Code:
$piccount=3

I don't advise changing this number above 5 as you will then have to change the templates Smile

so, in order to get three images, in ascending order, from forum 10 and 12 you would have:

PHP Code:
$piccount=3;
$query $db->query
("
            SELECT a.updatetime, a.md5hash, a.uploadtime, a.aid, a.attachname, a.filename, a.thumbs, t.*
            FROM "
.TABLE_PREFIX."xtattachments a
            LEFT JOIN "
.TABLE_PREFIX."threads t ON (t.tid=a.tid)
            WHERE t.visible=1 AND a.thumbs!=' ' AND t.closed NOT LIKE 'moved|%' AND t.fid IN ('10','12')
            GROUP BY a.tid
            ORDER BY t.tid ASC
                                  LIMIT 0, 
$piccount
"
); 
Then, copy/paste over the top of the query in the block file. Make sure you get all of it.

I DON'T advise this plugin for newbie users of MYBB - but then, if you have XThreads up and running then you won't be a total newbie Smile

Backlink

There is a backlink in the gallery to leefish.nl. You are free to remove the backlink - or - as was my intention - to change the link to point to your gallery - or even leave the link as it is

PHP Code:
    $backlink.="<td class='trow2' colspan='5'><div class='float_right'><a href='http://www.leefish.nl/mybb/forumdisplay.php?fid=51' target='blank'>A MYBB plugin by Leefish</a></div></td>"




Please note - if you want support/help on this outside the info above you will need to be a member Smile Unless you are Rocketfoot, cos he is my pal.....

Screenshots
XThreads Gallery on Pro_Portal Screenshot XThreads Gallery on Pro_Portal Screenshot  
Download link
Filesize 1.58 KB | File Name gallery block v2.rar | # of Downloads 139
File Updated 28-03-2012

Comments
#11 15-01-2013 
I made the mistake of keeping a renamed copy of the original center block in the portal/blocks folder. My bad, sry about that.
But I just deleted the extra file on the server and uploaded a fresh one with your code in it and it still displays the garage images horizontally and not vertically. I need the block to display only one image wide and run the rest of the garage images vertically.

btw, I used notepad

#12 15-01-2013 
do you have a link to your site where you have the gallery running?

I don't have pro_portal to test with you see
The site don't jive? PRESS F5 Flower

#13 15-01-2013 
Here you go! Do you need me to create an admin acct for you with password?

http://www.pantherbb.com/

#14 16-01-2013 
Thanks, it's perfect now. Big Grin yer da best!


Sorry, that is a members only option