• 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 157
File Updated 28-03-2012

Comments
#2 02-02-2011 
  • rocketfish
 
Hi Lee...No, I wouldn't run you over! I do have a little patience! LOL

I did try the new plugin but I'm gonna have to do some investigating...I get a password=NO error when I try to visit the proportal after installation.

#3 02-02-2011 
LOL - what was that???
Hmm, thats a bit odd - do you have it activated?
The site don't jive? PRESS F5 Flower

#4 02-02-2011 
Hmm, I just redownloaded the file from this post and uploaded to the test board - and its fine. Pics are a bit bigass - you can fix that though:

Find the line below
Code:
$thumb = xthreads_get_xta_url($centgallery).'/thumb320x240';

Change to another thumb size that you have set in your custom thread fields.... I am using 160x120 on test and it looks nice.
The site don't jive? PRESS F5 Flower

#5 28-03-2012 
Thanks for the update, I'm checking it out now!
Ok, checked it out and it works, but it doubles... I think I can fix that though Big Grin
Do you mind if I move the link back to the footer?
Yin, proud to be a member of LeeFish since Mar 2012.
And proud to be the owner of Atlas Productions - Cavern Of Creativity!

#6 28-03-2012 
Feel free to remove the link - it is a test to see if you can Big Grin

* leefish chuckles evilly......

Yea, I will help if you get stuck. I remember this is what led me to making my first plugin - editing existing ones.
The site don't jive? PRESS F5 Flower

#7 14-01-2013 
Hi Leefish! Great site and I love the MYbb work that you do. I had got in touch with Rocketfoot to find out how he was able to get the proportal random gallery block to display vertically instead of horizontally so I can place it left or right on my portal page.
He said that you had helped him with this and I was hoping that you would help me as well. I would appreciate it. Big Grin
Thanks

#8 14-01-2013 
hi, it should be as simple as adding a BR but I will download it and have a look.

Ok, I think - you can do this: Open the block file in Notepad++, find the lines below:

[php=32]
$centergallery.="<td align='center' class='trow1'>
<a href='{$threadlink}'><img src='{$thumb}' alt='{$threadtitle}' title='{$threadtitle}' /></a>
<br />
<span class='smalltext'><em><a href='{$threadlink}'>{$threadtitle}</a><br />
{$replies} Comments, {$views} Views</em></span>
</td>";
[/php]

Change to

[php=32]
$centergallery.="<td align='center' class='trow1'><div>
<a href='{$threadlink}'><img src='{$thumb}' alt='{$threadtitle}' title='{$threadtitle}' /></a>
<br />
<span class='smalltext'><em><a href='{$threadlink}'>{$threadtitle}</a><br />
{$replies} Comments, {$views} Views</em></span></div><br />
</td>";
[/php]

Not tested.
The site don't jive? PRESS F5 Flower

#9 15-01-2013 
Vwoe!!!!!!!!!

Server didn't like that...LOL

"Server error
The website encountered an error while retrieving http://www.pantherbb.com/portal.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this web page later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request."

#10 15-01-2013 
That is odd, what did you use to edit the file?

The worst it should do is be malformed HTML.
The site don't jive? PRESS F5 Flower


Sorry, that is a members only option