Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 21 Dec 2015, 18:32
Mornagest Mornagest is offline
 
Join Date: Sep 2009
See latest attached files on sidebar block ?

Hello,

We have some video game mod developers on our forums and they asked me if that was possible to see the X latest attached files posted on the forum, in a sidebar block.

All I found is the PHP script that shows them in the admin panel :
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Would it be possible to have the same showing those results in a sidebar block, such as the latest posts ?

Maybe it isn't difficult to find how but I know nothing about PHP...

Thank you in advance !
Reply With Quote
  #2  
Old 22 Dec 2015, 05:39
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
This is how I set up the forum block in the "Forum Blocks Manager":



This is the PHP code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And this is the result on my local dev site:



The usernames are shown in their usergroup HTML markup, and link to their profiles. The attachment filename has a tooltip that shows when it was uploaded, the number of views and the size of the file (in KB).

Below the filename is a link to the post containing the attachment.

You can edit the PHP code, the second line, to change the number of most recent attachments to display...replace the "5" with whatever positive integer you want.

Please let me know of any changes you would like.
Attached Images
File Type: png latest_attachments.png (43.4 KB, 32 views)
File Type: png latest_attachments_block.png (11.4 KB, 32 views)
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #3  
Old 22 Dec 2015, 12:16
Mornagest Mornagest is offline
 
Join Date: Sep 2009
Hello Mark,

And thank you for your quick answer

I made a try and got a database error. This comes up because we put a prefix to all our vBulletin tables (we have several other databases so we chose to prefix their tables). I tried to add the prefix to the query but it still doesn't work ; I don't know where to add it.

As you can see, the prefix is vb_ ; where should I add it ?

Again, thank you !


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #4  
Old 22 Dec 2015, 12:40
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Try this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #5  
Old 22 Dec 2015, 18:29
Mornagest Mornagest is offline
 
Join Date: Sep 2009
Hello Mark, and thank you

I tried this but it still didn't work. Here's the error message :
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

So I tried by adding the vb_ prefix only for the rows (I guess "vb_attachment.*, vb_user.*, vb_post.postid, vb_post.threadid, vb_thread.title, vb_filedata.filesize" are rows in tables ?) and NOT for the tables and that works perfectly now

Many many thanks to you, Mark, for your patience and receptiveness



edit : here's the final code :
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by Mornagest; 22 Dec 2015 at 18:31. Reason: added the final version of the code
Reply With Quote
  #6  
Old 22 Dec 2015, 18:38
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Okay, I understand what you did and why it works. I am thinking that a version that would work for any prefix would be:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #7  
Old 22 Dec 2015, 18:44
Mornagest Mornagest is offline
 
Join Date: Sep 2009
It tried this version and that works perfectly

Maybe this trick could be proposed as a small mod or else ? I guess I'm not the only one in the universe to seek this kind of widget...

Thank you once more, Mark !
Reply With Quote
  #8  
Old 22 Dec 2015, 18:48
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Originally Posted by Mornagest View Post
It tried this version and that works perfectly

Maybe this trick could be proposed as a small mod or else ? I guess I'm not the only one in the universe to seek this kind of widget...

Thank you once more, Mark !
Yes, I am considering creating a product that will auto-create the forum block, and allow the user to configure the block (# of attachments to show (or all within the last X time periods), the CSS of the block and whatever other options I can think of) from settings in the AdminCP.

If I do, I will list you as the co-author, because it was your idea.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #9  
Old 22 Dec 2015, 19:18
Mornagest Mornagest is offline
 
Join Date: Sep 2009
I would be honored though it's not only my idea, it was also members of my forum's !
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mini Mods BT - vBCMS: Latest threads block sidebar BlackThorn Modification Graveyard 6 04 Jun 2010 00:10
Miscellaneous Hacks You Can't See Attached Files Before Replying germinus vBulletin 3.7 Add-ons 12 01 May 2010 16:33
Mini Mods You Can't See Attached Files Before Replying beebi Modification Graveyard 79 01 Nov 2008 17:42



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:09.

Layout Options | Width: Wide Color: