Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 230
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 212
Total: 212

Author Topic: Latest comments  (Read 33063 times)

0 Members and 1 Guest are viewing this topic.

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Latest comments
« on: January 15, 2008, 12:26:01 am »
Hello, any way to create a tp module that shows latest comments added?

Thank you.

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #1 on: January 15, 2008, 02:57:06 pm »
Is it possible to do it?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Latest comments
« Reply #2 on: January 15, 2008, 07:58:32 pm »
Yes it is would require checking the gallery comments table with a database query
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #3 on: January 16, 2008, 07:52:20 am »
I can't do it... is it easy for you create that query?

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #4 on: January 17, 2008, 10:57:44 am »
Please some one can help me to create a php module that show latest comments?

Offline rumboogy

  • Full Member
  • ***
  • Posts: 215
    • View Profile
    • Smorgasboard Forums
Re: Latest comments
« Reply #5 on: January 17, 2008, 12:23:48 pm »
I like that idea...but unfortunately it would take more expertise than I have...interesting though...I will watch this thread. You could also check over at the TP Site.

Wally
« Last Edit: January 17, 2008, 12:25:59 pm by rumboogy »
Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #6 on: January 18, 2008, 05:56:26 am »
@admin: can you create a module like this?

http://www.smfhacks.com/index.php/topic,125.msg8845.html#msg8845

I think you can modify it to make it showing latest comments instead of random images.
Am i right or maybe it is more difficult than i think?

I hope can do it.

Thank you.

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #7 on: January 20, 2008, 05:47:23 pm »
Anyone (maybe a programmer) can help me?

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #8 on: March 10, 2008, 10:20:13 am »
I'm here again!

I tried my best to write this:

Code: [Select]
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;

$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment GROUP BY comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</small></a><br />Written by: <strong>', $row['ID_MEMBER'],  ' '
;}

It works, but it shows only 1 comment...
So, do you know how to make it to show more than 1 comment? I write LIMIT 5 but it does not work!
In addition, do you know how to show member name instead of member id ?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Latest comments
« Reply #9 on: March 10, 2008, 07:29:55 pm »
Try this
Code: [Select]
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;

$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($request))
      {
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</small></a><br />Written by: <strong>', $row['ID_MEMBER'];
       }
mysql_free_result($request);

}
« Last Edit: March 10, 2008, 08:09:12 pm by SMFHacks »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline rumboogy

  • Full Member
  • ***
  • Posts: 215
    • View Profile
    • Smorgasboard Forums
Re: Latest comments
« Reply #10 on: March 10, 2008, 07:51:26 pm »
I tried smartmouse's code and got no errors, but I also got no comment.

I tried Mr. Hacks code...and got the same thing. Just curious...and you may or may not want to develop this or work on it...but to me it seems like it would have more meaning if the block ALSO included the image that was being commented on...

Thanks.

Wally
Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #11 on: March 11, 2008, 08:49:35 am »
My friend help me and now it works. Here is the working code:

Code: [Select]
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;
 
$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment GROUP BY comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</a><br />Scritto da: <strong>', $row['ID_MEMBER'],  '<br /><br /></strong></small> ';
}
mysql_free_result($request);
}

Now i have to fix just the last thing: how to show member name instead of member id?
It results in messages like "Hello world" written by: 2, instead of "Hello world" written by: John.

Do you understand what i mean? How to fix it?

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #12 on: March 11, 2008, 08:51:56 am »
Ehm.. it is the same code posted by SMFHacks.
Anyway how to fix my problem?

Offline rumboogy

  • Full Member
  • ***
  • Posts: 215
    • View Profile
    • Smorgasboard Forums
Re: Latest comments
« Reply #13 on: March 11, 2008, 10:32:57 am »
Ehm.. it is the same code posted by SMFHacks.
Anyway how to fix my problem?

Smartmouse...I only get a blank block with your new code.

Also...don't you think the block should also include the image with the last comment?  yes, no?

Maybe I am missing something, the function ssi_lastcom ($cat)...is that something that should be in my SSI.php file?

Wally
Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com

Offline smartmouse

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Latest comments
« Reply #14 on: March 11, 2008, 12:33:04 pm »
I added the code that i posted above at the end of SSI.php file.
Then i create a new block in TPortal and i added the following code:

Code: [Select]
ssi_lastcom();
It works.

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
4074 Views
Last post March 26, 2007, 12:18:01 pm
by brianjw
4 Replies
6744 Views
Last post August 19, 2008, 08:56:54 pm
by bluedevil
5 Replies
6994 Views
Last post September 05, 2008, 02:32:18 pm
by MoreBloodWine
13 Replies
9637 Views
Last post September 18, 2008, 10:56:56 pm
by Boomslanger
4 Replies
3747 Views
Last post December 03, 2012, 11:02:10 am
by Jonas1975

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal