• Welcome to Simple Machines Community Forum. Please login or sign up.
December 08, 2021, 01:48:53 AM

News:

SMF 2.0.18 has been released! Please update. Read more.


Thank-O-Matic (Updated for SMF 2.0.4)

Started by Adk-Team, June 12, 2007, 12:18:59 PM

Previous topic - Next topic

Kindred

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Acer1963

My English is not so good ... sorry! You can also set the button down? If so how can this be done?
Greeting Acer1963

Skaty

Quote from: Simple Site Designs on October 17, 2012, 09:08:58 PM
Working on a very custom layout and am using this mod to upvote posts.

Just wondering if there is a way to get the "most thanked" post ID from within "Display.template.php". I need to show a link to it in the header (regardless of the page it's on).

Cheers,
Josh

UPDATE: I can do it like this, but don't really like doing loops when there might be a heap of messages


  // Count up the thanks and work out if we have a winning post
  $bigthx = 0;
  foreach($context['thank_you_post'] as $thxmsgid => $thxpost) {
    if(is_numeric($thxmsgid)) {
      $thisthx = count($thxpost['fulllist']);
      if($thisthx > $bigthx) {
        $bigthx   = $thisthx;
        $bigthxid = $thxmsgid;
      }
    }
  }
  // $scripturl.'?topic='.$context['current_topic'].'msg'.$bigthxid.'#msg'.$bigthxid

Quote from: Yiorgos on October 18, 2012, 03:35:20 PM
Hi Josh
That SQL query will retrieve the record that has the maximum number of "ThankYous"
I tested that with my phpmyadmin and works fine.
Then you may use the values for displaying Poster Title and construct a link to the thread
`thank_you_post_counter` contains the number of "ThankYous"

Please note that some columns may differ from your `smf_messages` table, due to the various modifications installed. Clear out from SELECT, the columns you do not need.



SELECT `id_msg` , `id_topic` , `id_board` , `poster_time` , `id_member` , `id_msg_modified` , `subject` , `poster_name` , `poster_email` , `poster_ip` , `smileys_enabled` , `modified_time` , `modified_name` , `body` , `icon` , `hiddenOption` , `hiddenValue` , `hiddenInfo` , `thank_you_post` , `thank_you_post_counter` , `approved`
FROM `smf_messages`
ORDER BY thank_you_post_counter DESC
LIMIT 1





Also remember that you may easily display top 5 users Thankyou statistics.
That will increase competition among users to up-vote threads



<?php ssi_thankYouPostTopResived(); ?>
<?php ssi_thankYouPostTopGiven(); ?>



I want to show most thanked post but i didnt get how to add in my display template. Where i have to put sql queries exactly ?

Simple Site Designs

Hi Skaty,

SQL/Data queries go in the source files (not the presentation templates). In the case of this one I added this:


  // Get info id of the most thanked message.
$request = $smcFunc['db_query']('', '
    SELECT ms.id_msg
    FROM {db_prefix}messages AS ms
  WHERE ms.id_topic = {int:current_topic}
    AND   ms.thank_you_post_counter > 0
    ORDER BY ms.thank_you_post_counter DESC
    LIMIT 1',
array(
'current_topic' => $topic,
)
);
if ($smcFunc['db_num_rows']($request) == 1) {
    $topicinfo['thank_you_post_most'] = $smcFunc['db_fetch_assoc']($request);
    $topicinfo['thank_you_post_most'] = $topicinfo['thank_you_post_most']['id_msg'];
  $smcFunc['db_free_result']($request);
} else {
  $topicinfo['thank_you_post_most'] = false;
  }


directly above the line (around line 250):


  // Add up unapproved replies to get real number of replies...


In the source file: Display.php

Hope that helps.

Skaty

Quote from: Simple Site Designs on April 16, 2013, 01:27:14 AM
Hi Skaty,

SQL/Data queries go in the source files (not the presentation templates). In the case of this one I added this:


  // Get info id of the most thanked message.
$request = $smcFunc['db_query']('', '
    SELECT ms.id_msg
    FROM {db_prefix}messages AS ms
  WHERE ms.id_topic = {int:current_topic}
    AND   ms.thank_you_post_counter > 0
    ORDER BY ms.thank_you_post_counter DESC
    LIMIT 1',
array(
'current_topic' => $topic,
)
);
if ($smcFunc['db_num_rows']($request) == 1) {
    $topicinfo['thank_you_post_most'] = $smcFunc['db_fetch_assoc']($request);
    $topicinfo['thank_you_post_most'] = $topicinfo['thank_you_post_most']['id_msg'];
  $smcFunc['db_free_result']($request);
} else {
  $topicinfo['thank_you_post_most'] = false;
  }


directly above the line (around line 250):


  // Add up unapproved replies to get real number of replies...


In the source file: Display.php

Hope that helps.

Thank you.  I added this code in display.php but i think there have to be something for display.template.com. I added the codes abode, but can't see the most thanked topic or post. There is missing something :(

  // Count up the thanks and work out if we have a winning post
  $bigthx = 0;
  foreach($context['thank_you_post'] as $thxmsgid => $thxpost) {
    if(is_numeric($thxmsgid)) {
      $thisthx = count($thxpost['fulllist']);
      if($thisthx > $bigthx) {
        $bigthx   = $thisthx;
        $bigthxid = $thxmsgid;
      }
    }
  }
  // $scripturl.'?topic='.$context['current_topic'].'msg'.$bigthxid.'#msg'.$bigthxid

4LP3RUZ1

I get a small bug and error logs which I have traced back to the permission system.

Heres the deal;

The error message is as follows:
http://www.****.com/index.php?action=profile
8: Undefined index: label
File: /www/toyotaclubtr.com/public_html/Themes/default/GenericMenu.template.php
Line: 180


Now this only happened with users on 0 messages, which got me thinking that it was a permission problem.

What happens is, my 0 message users DON'T have permissions to view OTHER user profiles, only their own.

If a 0 message user goes into his profile screen, the ThankOMatic menu appears ($txt['thankyoutitle']), however the subsection menu does not appear. Its empty.

If I set the permission to view other profiles to ON, then the menu appears and I get no error message in the log.

So,

The question is. How can I get rid of the error without changing the permissions? (I don't want 0 message users looking at other user profiles...)
Frozen frogs are back :(

emanuele

The version currently uploaded reports only the changes to the header of the Memberlist.template.php table and not the change needed to the table itself.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Smael

Updater seems to fail on multiple pages. Attempted to install it manually but found that the source files are not at all sync to the instructions..

Kindred

That is hardly the fault of the mod...
http://wiki.simplemachines.org/smf/Error_in_mod_installation

the mod installs just fine on a default SMF install. If you have made other modifications already, then there is a chance any additional mod will not be able to auto-install and you will have to manually apply the changes
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Smael

Quote from: Kindred on May 08, 2013, 07:34:41 AM
That is hardly the fault of the mod...
http://wiki.simplemachines.org/smf/Error_in_mod_installation

the mod installs just fine on a default SMF install. If you have made other modifications already, then there is a chance any additional mod will not be able to auto-install and you will have to manually apply the changes

I'm aware.

I've done attempts to install it manually however:

echo '
<span>', $poster['time_online'], '</span>
</dd>';
}


This is for example non-existant in my code.

Kindred

yup...   and if you have mods which have alreayd altered the target code or custom themes which used a different style of coding, then you have ot start using human intuition on where it should actually be added....
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arvacon

Hi.
I am getting this error during the installation.

QuoteError in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Code: (Find) [Select]
         mem.time_format, mem.secret_question, mem.is_activated, mem.additional_groups, mem.smiley_set, mem.show_online,
mem.total_time_logged_in, mem.id_post_group, mem.notify_announcements, mem.notify_regularity, mem.notify_send_body,

Code: (Replace) [Select]
         mem.time_format, mem.secret_question, mem.is_activated, mem.additional_groups, mem.smiley_set, mem.show_online,
mem.total_time_logged_in, mem.id_post_group, mem.notify_announcements, mem.notify_regularity, mem.notify_send_body,
mem.thank_you_post_made, mem.thank_you_post_became, last_thank_you_time,


This error seems to be at the file ./Sources/Load.php
What do I need to do to correct this?

TheListener

Error in your forums error log?

Which mods if any are installed?

Arvacon

Nop, I don't have any errors at my log. This error comes when I try to install the thankomatic mod.

These are the mods I have already installed at my forum:

1.   Drafts (for SMF 2.0 / SMF 1.1)   2.0.1   
2.   Simple ImageShack   3.1.3   
3.   Greeklish to Greek   1.01   
4.   Aeva Media   1.4w   
5.   SMF 2.0.4 Update   1.0   
6.   Tapatalk SMF 2.0 RC5/Final Plugin   3.4.0   
7.   Custom View of Attachments   0.9   
8.   Highslide 4 SMF   0.8.1   
9.   New Hooks   0.1   
10.   SMF 2.0.3 Update   1.0   
11.   InLine Attachments   1.2.1   
12.   Fancy Features   1.4   
13.   Watermark.light   1.5   
14.   Resize Attached Images   2.4.1   
15.   Adk Snow Effect   2.0   
16.   Join date and Location in Posts   1.3   [
17.   Allow Access while in Maintenance Mode   1.2   
18.   Ad Managment   3.0.1   
19.   TinyPortal   1.107   

Arvacon

Ok I think the problem is that the aewa has changed these lines so the code at my load.php looks like this:

mem.time_format, mem.secret_question, mem.aeva_items, mem.aeva_comments, mem.is_activated, mem.additional_groups, mem.smiley_set, mem.show_online,
mem.total_time_logged_in, mem.id_post_group, mem.notify_announcements, mem.notify_regularity, mem.notify_send_body,


Should I continue with the installation and just go and add the new code after the installation, to look like this afterwards?

mem.time_format, mem.secret_question, mem.aeva_items, mem.aeva_comments, mem.is_activated, mem.additional_groups, mem.smiley_set, mem.show_online,
mem.total_time_logged_in, mem.id_post_group, mem.notify_announcements, mem.notify_regularity, mem.notify_send_body,
mem.thank_you_post_made, mem.thank_you_post_became, last_thank_you_time,


Edit: I see there are also 5 errors at the core theme as it says, but I don't use this theme, so I have leave it unchecked. Could this affect the function of the mod?
At the custom theme I use, there are not errors, as that uses the default theme.

TheListener

* Old Fossil is not a code expert

No harm in trying eh?

But do a BACK UP first.

Arvacon

Old Fossil, Arvacon is not a code expert too!  ;D
But I have already made a backup and I finally did a try.
It seems everything installed correctly and I can see the admin thankomatic panel now.
I did also that correction and we will see.

One tip only: I crossed my fingers during the installation!  :P

TheListener


Arvacon

Ok, my error log shows nothing, but when I try to access the topics, now the forum disappears and I get this error at a white screen!!!
Oh no...  :(

QuoteTemplate Parse Error!

There was a problem loading the /Themes/default/Display.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_ELSEIF

Kindred

First, read the wiki. It explains what that error message means and ow to work around it (hint:manually installing the bits that failed)

Second, no.. It you don't have the core theme installed or used, it won't matter.  Actually if you completely delete it, you will be better off.

Third, it would appear that you had more than one failure and that yu need to manually do more... Specifically in display.template.php
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: