collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 430
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Thank-o-matic block  (Read 7401 times)

0 Members and 1 Guest are viewing this topic.

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Thank-o-matic block
« on: January 08, 2009, 07:32:11 AM »
Hello everyone

First of all, thank a lot for that magnificent piece of software and the friendly support you´re providing here.

Now, my SMF 1.1.7 site has Thank-o-matic mod (1.2.5) installed and I´m wondering if it would be possible to create a ¨Most thanks received¨ block for the Portal (2.0.5), which would display who received the most thanks in Thank-o-matic, in a similar fashion to "Top 5 posters" block.

Any hints on how to achieve this?

Cheers.
« Last Edit: January 08, 2009, 09:27:01 AM by dabeer »

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Thank-o-matic block
« Reply #1 on: January 08, 2009, 05:21:49 PM »
i think i can make a php block for this ;)
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #2 on: January 08, 2009, 05:32:25 PM »
I'd be very much obliged  :holding-flower:

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Thank-o-matic block
« Reply #3 on: January 09, 2009, 12:34:02 AM »
The easiest way is :)

Most Thank Yo Given:
Code: [Select]
global $boarddir;
require_once($boarddir.'/SSI.php');
ssi_thankYouPostTopGiven(5);

Most Thanks You's resived:
Code: [Select]
global $boarddir;
require_once($boarddir.'/SSI.php');
ssi_thankYouPostTopResived(5);

You can change the 5 to the number you like to see :).

Bye
DIN1031
« Last Edit: January 31, 2009, 01:12:18 PM by ???1031 »
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #4 on: January 09, 2009, 01:55:11 AM »
Thank you, it worked, however I had to change line 2 of the code to:
Code: [Select]
require_once($boarddir.'/SSI.php');(slash was missing)

Also, shouldn't the name of the function be ssi_thankYouPostTopReceived instead of ssi_thankYouPostTopResived?

Anyone got an idea how to display avatars there as well?

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Thank-o-matic block
« Reply #5 on: January 10, 2009, 03:54:47 PM »
Yes that was a mistake in my first version... but i could not change it because so many use it when i saw it xD.

Hmmm avatars is not so easy, but i will see if i can do that :X.

Bye
DIN1031
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #6 on: January 12, 2009, 04:57:08 PM »
Hmmm avatars is not so easy, but i will see if i can do that :X.

Actually, I'm really glad to have got it working the way it does now, but if you ever come up with code that shows avatars as well, I'll be delighted.

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #7 on: January 15, 2009, 05:40:30 AM »
While we're at Thank-o-matic code, another thing worth considering would be a kind of "top 5 thanks received posts" which would display X posts with most thanks received (so the most valuable ones, the mod could actually be called "5 Most Valuable posts")

What do you reckon?

Any easy way of implementing that?
« Last Edit: January 15, 2009, 08:42:26 AM by dabeer »

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Thank-o-matic block
« Reply #8 on: January 31, 2009, 01:13:10 PM »
It's not so easy, because it's the standard ssi version :X
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Thank-o-matic block
« Reply #9 on: February 02, 2009, 04:13:52 PM »
TopGiven with avatars:

Code: [Select]
global $boarddir, $memberContext;

require_once($boarddir.'/SSI.php');

$top_given = ssi_thankYouPostTopGiven(5, 'array');

echo '
<table>';

foreach ($top_given as $member)
{
loadMemberData($member['id']);
loadMemberContext($member['id']);

echo '
<tr>
<td style="width: 55px; text-align: center;">', !empty($memberContext[$member['id']]['avatar']['href']) ? '
<img src="' . $memberContext[$member['id']]['avatar']['href'] . '" alt="' . $member['name'] . '" width="50" />' : '', '
</td>
<td>
', $member['link'], '<br />
<span class="smalltext">
<strong>', $txt['thank_you_post_made_display'], ':</strong> ', $member['thank_you_post_made'], '<br />
<strong>', $txt['thank_you_post_became_display'], ':</strong> ', $member['thank_you_post_became'], '
</span>
</td>
</tr>';
}
echo '
</table>';

If you want it to be top recieved, just change 'TopGiven' to 'TopResived'.

Top Thanked Posts:

Code: [Select]
global $db_prefix, $scripturl, $user_info, $txt;

$request = db_query("
SELECT
m.ID_MSG, m.ID_TOPIC, m.ID_MEMBER, m.subject, COUNT(*) AS thanks,
IFNULL(mem.realName, m.posterName) AS posterName
FROM {$db_prefix}thank_you_post AS ty
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = ty.ID_MSG)
LEFT JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE $user_info[query_see_board]
AND b.thank_you_post_enable = 0
GROUP BY ID_MSG
ORDER BY thanks DESC
LIMIT 10", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
$return[] = array(
'id' => $row['ID_MSG'],
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
'thanks' => $row['thanks'],
);
mysql_free_result($request);

echo '
<ol>';

foreach ($return as $post)
echo '
<li>', $post['link'], ' <span class="smalltext">', $txt[525], ' ', $post['poster']['link'], '<br />', $txt['thank_you_post_thx_display'], ': ', $post['thanks'], '</li>';

echo '
</ol>';
And slowly, you come to realize... It's all as it should be...

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #10 on: February 15, 2009, 10:53:49 AM »
Thanks, Blue Dream! Exactly what I had in mind  ;D

In Top Thanks Given/Received the only problem is that the strings $txt['thank_you_post_made_display'] and $txt['thank_you_post_become_display'] are not displayed. Both strings are defined in index.MYLANGUAGE.php and they are both displayed without problems in other mods. Any idea what I'm missing?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Thank-o-matic block
« Reply #11 on: February 15, 2009, 10:56:08 AM »
Find:

Code: [Select]
global $boarddir, $memberContext;
Repace:

Code: [Select]
global $boarddir, $memberContext, $txt;
And slowly, you come to realize... It's all as it should be...

Offline dabeer

  • Semi Newbie
  • *
  • Posts: 11
Re: Thank-o-matic block
« Reply #12 on: February 15, 2009, 11:17:47 AM »
Thanks, it worked!