Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 272
Total: 272

Author Topic: Latest comments  (Read 33006 times)

0 Members and 1 Guest are viewing this topic.

Offline Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #45 on: December 14, 2011, 04:40:21 pm »
Thanks a lot for the help so far!  :)

Nothing happens with the new block code. The block is still empty.

I also got this error message:

It appears that your database need an upgrade. Your forum files are version SMF 2.0.1, while your database contains the version 2.0. To try to correct the error mentioned above, it is recommended that you run the latest version of upgrade.php.

Can this be something? If so, where do I find the upgrade.php file?


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Latest comments
« Reply #46 on: December 14, 2011, 04:45:35 pm »
No wouldn't be part of that. Sounds like a portal issue. I ask the portal developers to see how to get a block working since that simple block should work.
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 Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #47 on: December 14, 2011, 05:00:29 pm »
Thanks a lot, SMFHacks! I appreciate your help!

Offline Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #48 on: September 21, 2012, 03:36:23 pm »
My members (and me) need a "Last commented pictures" block on the frontside of the forum. When I don't have such a block no one will discover new comments and the the people that upload pictures will not be noticed that someone has commented their pictures. I'm using Tiny Portal, and I think this should be an easy jobb to make, but unfortunately I don't have the skills to do it. On the info-center on my forum index page I have a nice list with last comments. It can be seen here: http://hellasforum.net/index.php?action=forum Maybe this could be converted to a sideblock??

Offline Jonas1975

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • The Mobile Photography Blog
Re: Latest comments
« Reply #49 on: September 22, 2012, 05:01:08 am »

Offline Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #50 on: September 22, 2012, 05:53:51 am »
Yes, this is the mod I'm referring to in my post above. Maybe the code for this mode could be used for a sideblock? I have tried to make something out of it, but don't have the skills to make it work.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Latest comments
« Reply #51 on: September 23, 2012, 12:08:20 pm »
Try this code
Code: [Select]

global $smcFunc, $scripturl, $txt;
$txt['gallerymod_guest'] = 'Guest';

$dbresult = $smcFunc['db_query']('', "
SELECT
p.ID_PICTURE, p.ID_CAT, p.USER_ID_CAT, p.title, c.ID_MEMBER, c.comment, c.date,
m.real_name, a.title catname, c.ID_COMMENT, u.title catname2
FROM ({db_prefix}gallery_comment AS c, {db_prefix}gallery_pic as p)
LEFT JOIN  {db_prefix}gallery_cat AS a ON (a.ID_CAT = p.ID_CAT)
LEFT JOIN  {db_prefix}gallery_usercat AS u ON (u.USER_ID_CAT = p.USER_ID_CAT)
LEFT JOIN {db_prefix}members AS m ON (c.ID_MEMBER = m.ID_MEMBER)
WHERE  c.ID_PICTURE = p.ID_PICTURE AND c.approved = 1 ORDER BY c.ID_COMMENT DESC LIMIT 10");

$context['gallery_comindex'] = array();
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
$context['gallery_comindex'][] = array(
'ID_PICTURE' => $row['ID_PICTURE'],
'ID_COMMENT' => $row['ID_COMMENT'],
'title' => $row['title'],
'ID_CAT' => $row['ID_CAT'],
'USER_ID_CAT' => $row['USER_ID_CAT'],
'ID_MEMBER' =>  $row['ID_MEMBER'],
'real_name' => $row['real_name'],
'catname' => $row['catname'],
'catname2' => $row['catname2'],
'comment' => $row['comment'],
'date' => timeformat($row['date']),
);

echo '<strong><a href="' . $scripturl . '?action=gallery;sa=view;id=' . $row['ID_PICTURE'] . '#c' . $row['ID_COMMENT'] . '">' . (strlen($row['comment']) > 50 ? $smcFunc['substr']($row['comment'], 0, 50)  . '...' : substr($pic['comment'], 0, 50))  . '</a></strong> ', $txt['by'], ' ', ($row['real_name'] != '' ?  '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['real_name'] . '</a>' : $txt['gallerymod_guest']);
echo '&nbsp;' . timeformat($row['date']);
echo '<br />';


}
$smcFunc['db_free_result']($dbresult);
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 Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #52 on: September 23, 2012, 12:29:05 pm »
Thanks a lot, SMFHacks!  :) It works with two small errors. The first comment doesn't show up, only the author and the date. The same with the two last comments. Please see attached images.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Latest comments
« Reply #53 on: September 23, 2012, 12:34:38 pm »
Retry with this
Code: [Select]
global $smcFunc, $scripturl, $txt;
$txt['gallerymod_guest'] = 'Guest';

$dbresult = $smcFunc['db_query']('', "
SELECT
p.ID_PICTURE, p.ID_CAT, p.USER_ID_CAT, p.title, c.ID_MEMBER, c.comment, c.date,
m.real_name, a.title catname, c.ID_COMMENT, u.title catname2
FROM ({db_prefix}gallery_comment AS c, {db_prefix}gallery_pic as p)
LEFT JOIN  {db_prefix}gallery_cat AS a ON (a.ID_CAT = p.ID_CAT)
LEFT JOIN  {db_prefix}gallery_usercat AS u ON (u.USER_ID_CAT = p.USER_ID_CAT)
LEFT JOIN {db_prefix}members AS m ON (c.ID_MEMBER = m.ID_MEMBER)
WHERE  c.ID_PICTURE = p.ID_PICTURE AND c.approved = 1 ORDER BY c.ID_COMMENT DESC LIMIT 10");

$context['gallery_comindex'] = array();
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
$context['gallery_comindex'][] = array(
'ID_PICTURE' => $row['ID_PICTURE'],
'ID_COMMENT' => $row['ID_COMMENT'],
'title' => $row['title'],
'ID_CAT' => $row['ID_CAT'],
'USER_ID_CAT' => $row['USER_ID_CAT'],
'ID_MEMBER' =>  $row['ID_MEMBER'],
'real_name' => $row['real_name'],
'catname' => $row['catname'],
'catname2' => $row['catname2'],
'comment' => $row['comment'],
'date' => timeformat($row['date']),
);

echo '<strong><a href="' . $scripturl . '?action=gallery;sa=view;id=' . $row['ID_PICTURE'] . '#c' . $row['ID_COMMENT'] . '">' . (strlen($row['comment']) > 50 ? $smcFunc['substr']($row['comment'], 0, 50)  . '...' : substr($row['comment'], 0, 50))  . '</a></strong> ', $txt['by'], ' ', ($row['real_name'] != '' ?  '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['real_name'] . '</a>' : $txt['gallerymod_guest']);
echo '&nbsp;' . timeformat($row['date']);
echo '<br />';


}
$smcFunc['db_free_result']($dbresult);
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 Dylert

  • Member
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Latest comments
« Reply #54 on: September 23, 2012, 12:36:15 pm »
Works perfect! Great! Thanks a lot!  :) :)

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Latest comments
« Reply #55 on: October 19, 2012, 07:20:38 pm »
Using this too ;D

 

Related Topics

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

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

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

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal