Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Bugo on January 05, 2012, 11:13:27 PM

Title: Topic Rating Bar
Post by: Bugo on January 05, 2012, 11:13:27 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=3236)
AJAX Star Rating Bar for your topics.

Features:

PHP-block to show the best topic on any area or portal:
TopicRatingBar::getBestTopic();
loadTemplate('TopicRatingBar');
template_best_topics_above();

AJAX-рейтинг со звёздочками для ваших тем.

Особенности:

(https://img.shields.io/github/license/dragomano/topic-rating-bar?color=blue) (https://img.shields.io/badge/Donate-$-blue.svg?style=flat&logo=paypal) (https://ko-fi.com/dragomano)
Title: Re: Topic Rating Bar
Post by: MaXiForum.cz on January 06, 2012, 02:43:15 AM
Nice, good work again ;)
Title: Re: Topic Rating Bar
Post by: funkythemunky on January 10, 2012, 07:29:58 AM
Thanks a lot for this mod!  :) Appreciate it very much! :laugh:

Is there by any chance a way to make the rating bar in the topic smaller in height?
Where and which .css would I have to modify, if so?
Title: Re: Topic Rating Bar
Post by: Bugo on January 10, 2012, 02:02:36 PM
/Themes/default/css/rating.css
Title: Re: Topic Rating Bar
Post by: funkythemunky on January 10, 2012, 07:30:55 PM
Thank You!
I did not change much, as You can see, but I like it better like this...more decent.  :laugh:
Title: Re: Topic Rating Bar
Post by: funkythemunky on January 26, 2012, 02:37:12 PM
Hey an update!  ;)

Was sth important changed?
Title: Re: Topic Rating Bar
Post by: Bugo on January 26, 2012, 07:25:18 PM
Small changes in top rating function.
Title: Re: Topic Rating Bar
Post by: funkythemunky on January 26, 2012, 07:45:09 PM
And that means...? Could you please be a little more specific?  :D

What would I have to do if I wanted to update? uninstall/reinstall new version? would old ratings be redeemed by doing that?
Title: Re: Topic Rating Bar
Post by: Bugo on January 26, 2012, 08:42:38 PM
I never write what's new. If you want to update, just uninstall old version. then install new package. When uninstall don't check "remove all data" option. That's all.
Title: Re: Topic Rating Bar
Post by: Ascot on February 04, 2012, 01:18:08 PM
Hi there, i've install this mod... but nothing seems to happen D:
i mean, there isn't stars at topics, neither inside them.
Is there something i forgot to do?
Title: Re: Topic Rating Bar
Post by: Robert. on February 04, 2012, 02:19:48 PM
Are you using a custom theme?
Title: Re: Topic Rating Bar
Post by: Ascot on February 04, 2012, 03:02:43 PM
Quote from: フリーレンジ on February 04, 2012, 02:19:48 PM
Are you using a custom theme?
yes.  Do i need to edit something?
Title: Re: Topic Rating Bar
Post by: Bugo on February 04, 2012, 10:10:03 PM
Note: You cann't rate your own topics.
Title: Re: Topic Rating Bar
Post by: Ascot on February 05, 2012, 09:26:58 AM
Quote from: Bugo on February 04, 2012, 10:10:03 PM
Note: You cann't rate your own topics.
oh. that's good to know LOL
thanks
Title: Re: Topic Rating Bar
Post by: carajo on February 05, 2012, 12:30:57 PM
Thanks , works perfect!

Spanish-es_utf8 translation atached.
Title: Re: Topic Rating Bar
Post by: Bugo on February 06, 2012, 12:54:31 AM
You don't need translate the mod's name ("Topic Rating Bar").
Title: Re: Topic Rating Bar
Post by: Anthems on February 10, 2012, 10:55:06 AM
Quote from: Bugo on February 04, 2012, 10:10:03 PM
Note: You cann't rate your own topics.
Can you change that?

I have a forum where we rate music albums and that way I can't rate the topic I create.
Title: Re: Topic Rating Bar
Post by: MotRude on February 10, 2012, 03:36:51 PM
How can i add this to custom themes?
Title: Re: Topic Rating Bar
Post by: Bugo on February 11, 2012, 01:26:05 AM
Quote from: Anthems on February 10, 2012, 10:55:06 AM
I have a forum where we rate music albums and that way I can't rate the topic I create.
I'm sorry but it's a mod's feature. If you don't like this then use other mods.

Quote from: MotRude on February 10, 2012, 03:36:51 PM
How can i add this to custom themes?
Does this mod not work in custom themes?
Title: Re: Topic Rating Bar
Post by: MotRude on February 11, 2012, 10:24:05 AM
Obviously if it worked i wouldn't be asking this question!
Title: Re: Topic Rating Bar
Post by: Bugo on February 11, 2012, 12:54:07 PM
Prince of Darkness, Curve's variation? Look at screenshot.
Title: Re: Topic Rating Bar
Post by: Dersim62 on February 16, 2012, 08:14:23 AM
At first, big thanks to @Bugo!


I searched long time just to find a compatible "Topic Rating" Mod. for my forum. Because i have the newest SMF version (2.0.2) and all other mods are not compatible with my SMF Version, but finally i found it. I have only to small problems with that mod.


1. Problem: I`m using a bright Theme (flagrant)...so its a little bit difficult to see this Modification (Topic Rate), because its bright too. So is it not possible to add a text beside the mod. ? Like  "Rate this Topic" ? Can you please tell me how to fix it? It will be very nice.

Here is a screenshot:

(http://koyedersim.com/pic/screenshot/Text-Like-Rate-This-Topic.jpg)


2. Problem: I created two language.php files. German and Turkish. But anyway, you will see the mod in turkish. I selected under my profileoption the language of german, but the Mod. is still in turkish. Can you please take a look of my changed Modification? Is everything ok? I dont think so.
Title: Re: Topic Rating Bar
Post by: Bugo on February 16, 2012, 08:54:25 AM
1. TopicRating.template.php
2. Did you try to change language via Admin -> Configuration -> Languages?
Title: Re: Topic Rating Bar
Post by: yes100 on February 16, 2012, 07:04:45 PM
Hi, thank you for this great Mod!

Someone knows how to show the mini-ratings on a portal?
I'm using Adk-Portal with Auto-News which adds recent topics to the portal.

Any idea what code I have to add when I want to show the ratings for a known topic-id?


Thanks in advance for any help!

yes100
Title: Re: Topic Rating Bar
Post by: Dersim62 on February 18, 2012, 09:13:26 AM
Quote from: Bugo on February 16, 2012, 08:54:25 AM
1. TopicRating.template.php
2. Did you try to change language via Admin -> Configuration -> Languages?


1. Please can you tell me where in the "TopicRating.template.php" i must put my text? I dont want to get a error.
2. My Forum is set to turkish, But anyway, i have selected under my profileoption the language of german. So every mod. is changed to german, for me. Bu not the Topic Rating Bar, its still of turkish. But really, this is not so important, much more important is Number 1, in which line can i put my own text? Like this "Rate This Topic"
Title: Re: Topic Rating Bar
Post by: Bugo on February 18, 2012, 09:32:26 AM
Try a new version.
Title: Re: Topic Rating Bar
Post by: Branko. on February 18, 2012, 07:23:13 PM
Translation for:

serbian_latin
serbian_latin-utf8
serbian_cyrillic
serbian_cyrillic-utf8
croatian
croatian-utf8
Title: Re: Topic Rating Bar
Post by: Dersim62 on February 19, 2012, 01:49:08 AM
Quote from: Bugo on February 18, 2012, 09:32:26 AM
Try a new version.


You are the best! Finally everything works now! The Language file and the text beside mod! Thank you so much!
Title: Re: Topic Rating Bar
Post by: Anthems on February 19, 2012, 06:54:14 AM
Is there a way to show the stars in the board where the topic are? In front of each topic or so.
I can see the stars inside the topic but not outside.

And it would be really great if you could add support to vote own topics.
Title: Re: Topic Rating Bar
Post by: Branko. on February 19, 2012, 07:43:22 AM
Of course..Modification Settings>Topic Rating Bar  then Display mini-rating on the message index
Title: Re: Topic Rating Bar
Post by: Anthems on February 19, 2012, 08:29:58 AM
I had already checked the mini-rating box but it won't show the stars...

I'm using Prince of Darkness theme. I think it's pretty much the standard theme but with color modifications.
Title: Re: Topic Rating Bar
Post by: mkress on February 19, 2012, 03:15:26 PM
looks like there is a bug when caching is enabled (Caching with MemCache - Level 1 and up).
if caching is enabled the rating is shown up only some time....
Title: Re: Topic Rating Bar
Post by: Draffi on March 06, 2012, 03:00:35 PM
Any Help need.

Some members (and me too, as an admin) can rate topics. This happend since some days...

Always i read "You can't rate own topics!" but the topic was not started by me or the new members.

Also, for some members it is possible to rate this topics...curios! Maybe a cookie problem?
Title: Re: Topic Rating Bar
Post by: Stumpy on March 08, 2012, 02:27:09 PM
Bombing out completely a just displaying a message that says, "Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in blah/blah/blah/Sources/Subs-TopicRating.php on line 322

The only way I can get my site to open at all is to delete the Subs-TopicRating.php file.  I walked through the installer xml and it looks like everything ran the way it was supposed to and the database changes in database.php were made,  but I'm having no luck with the mod and it sounds like something I can really use.

SMF v 2.0.2

Any ideas?
Title: Re: Topic Rating Bar
Post by: Draffi on March 22, 2012, 01:16:05 PM
*BUMP*

Need help with my problem. Im the admin and cannot rate topics...
Title: Re: Topic Rating Bar
Post by: trekkie2444 on March 24, 2012, 06:25:44 PM
I had the same problem with the stars showing up without any text, and then out of nowhere the mod vanished entirely. I'm not sure what happened, but the bar does not show up, even if I uninstall it and reinstall the mod.

I got tons of these in my error log too:

Guest
180.76.5.62   
    Today at 02:27:33 PM
db8e2e26963d1a16ae17cb589c0a25eb
Type of error: General
http://e-p1.net/index.php?pretty;board=olympus-digital-pen-and-pen-cameras;topic=e-p1-used-prices-predicament.msg150738: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Argument is not a stringFile: [...]Sources/Subs-TopicRating.php
Line: 104
Title: Re: Topic Rating Bar
Post by: Inti31 on March 27, 2012, 06:02:58 AM
Nice!

I don't know if this is done by someone else  - find att'ed the german language
Title: Re: Topic Rating Bar
Post by: SBDave on March 27, 2012, 07:37:20 PM
1. The star outlines (gray) are not appearing because they blend in with my theme's background. Where in TopicRating.template.php can I modify the color of the outlines?

2. Can I modify the text bar to read "Rate this drink" instead of "Rate this topic"?

Thank you for any and all help!
Title: Re: Topic Rating Bar
Post by: Bugo on March 28, 2012, 03:08:09 AM
1. You can change all_stars.png file located in /Themes/default/images dir.
2. Just edit your language file (/Themes/default/languages/TopicRating/).
Title: Re: Topic Rating Bar
Post by: pixeleyes on March 28, 2012, 11:53:50 AM
User can do rating.

But mini stars doesn't show on post category during log-in session.

Only appears when log out.

Any idea how to fix this problem?
Title: Re: Topic Rating Bar
Post by: SBDave on March 28, 2012, 12:18:14 PM
Quote from: Bugo on March 28, 2012, 03:08:09 AM
1. You can change all_stars.png file located in /Themes/default/images dir.
2. Just edit your language file (/Themes/default/languages/TopicRating/).

Nice, thank you! I'm really liking your rating system - good work!
Title: Re: Topic Rating Bar
Post by: trekkie2444 on March 28, 2012, 06:07:44 PM
Bugo any idea about my problem?
Title: Re: Topic Rating Bar
Post by: SBDave on March 28, 2012, 07:11:39 PM
One more quick question, please: is there anyway for me to modify the code in order to allow Guests to rate as well? No problem if not, or if it's super difficult. Thanks again, take care.
Title: Re: Topic Rating Bar
Post by: Bugo on March 29, 2012, 04:36:26 AM
Quote from: trekkie2444 on March 28, 2012, 06:07:44 PM
Bugo any idea about my problem?
I would write to you if I had any ideas.
Quote from: SBDave on March 28, 2012, 07:11:39 PM
One more quick question, please: is there anyway for me to modify the code in order to allow Guests to rate as well? No problem if not, or if it's super difficult. Thanks again, take care.
This mod made for other goals.
Title: Re: Topic Rating Bar
Post by: trekkie2444 on March 30, 2012, 03:53:59 AM
Quote from: Bugo on March 29, 2012, 04:36:26 AM
Quote from: trekkie2444 on March 28, 2012, 06:07:44 PM
Bugo any idea about my problem?
I would write to you if I had any ideas.
Quote from: SBDave on March 28, 2012, 07:11:39 PM
One more quick question, please: is there anyway for me to modify the code in order to allow Guests to rate as well? No problem if not, or if it's super difficult. Thanks again, take care.
This mod made for other goals.

Well someone else posted about this too...it's kind of strange that it keeps happening. Can't you look into it?
Title: Re: Topic Rating Bar
Post by: novill on March 30, 2012, 05:35:04 PM
Thanks, excellent work!

Hungarian translation attached.

Google rich snippets integration is possible?
Title: Re: Topic Rating Bar
Post by: Draffi on March 30, 2012, 06:57:28 PM
so this meaning:

you (Bugo) are the creature of this mod, but you never can help us????!!!

Strange....
Title: Re: Topic Rating Bar
Post by: TheListener on March 30, 2012, 06:59:55 PM
Any errors in the error log?

Was it a clean install?
Title: Re: Topic Rating Bar
Post by: Bugo on March 31, 2012, 12:47:56 AM
Quote from: novill on March 30, 2012, 05:35:04 PM
Google rich snippets integration is possible?
Yeah, it's possible. See the latest version, 0.7. Use http://www.google.com/webmasters/tools/richsnippets for testing.

Branko., Inti31 and novill — thank you for translations.
Title: Re: Topic Rating Bar
Post by: Inti31 on March 31, 2012, 07:18:04 AM
I deinstalled 0.6.2 and installed 0.7 - it doesn't work for me - do I have to modfiy sth. manually?
There is no configuaration visible in Administrator and no permission can be set
I switched back to 0.6.2


Ups - have to think of get rid of my 4th testforum - I installed it to the 3rd testforum - but checked the 4th... *arrg*
works fine.
Title: Re: Topic Rating Bar
Post by: novill on March 31, 2012, 07:37:51 AM
I have I done the same, but it works perfectly for me. I just wait the google bot to crawl my site. (Google rich snippets)

update: Google rich snippets part works perfect

thanks Bugo
Title: Re: Topic Rating Bar
Post by: Anthems on April 01, 2012, 11:06:28 AM
I can't see the ratings in the boards.

But it would definitely be a good feature being able to rate own topics. For those people who have music or movie related topics, not being able to rate an album or a movie is frustrating.
Title: Re: Topic Rating Bar
Post by: trekkie2444 on April 01, 2012, 09:04:01 PM
Quote from: Anthems on April 01, 2012, 11:06:28 AM
I can't see the ratings in the boards.

But it would definitely be a good feature being able to rate own topics. For those people who have music or movie related topics, not being able to rate an album or a movie is frustrating.

You have the same problem as me?
Title: Re: Topic Rating Bar
Post by: Saahilk2000 on April 01, 2012, 09:13:07 PM
i cant see the ratings on the board either .... just on top of the topic but not in the index.
Title: Re: Topic Rating Bar
Post by: novill on April 02, 2012, 03:01:28 AM
Have you enabled "Display mini-rating on the message index"?
Title: Re: Topic Rating Bar
Post by: Saahilk2000 on April 02, 2012, 04:31:41 AM
Quote from: novill on April 02, 2012, 03:01:28 AM
Have you enabled "Display mini-rating on the message index"?

yes i have but still nothing
Title: Re: Topic Rating Bar
Post by: Bugo on April 02, 2012, 07:35:07 AM
Can you provide a link to your forum?
Title: Re: Topic Rating Bar
Post by: Saahilk2000 on April 02, 2012, 08:54:22 AM
Quote from: Bugo on April 02, 2012, 07:35:07 AM
Can you provide a link to your forum?

here you ho .... thanks man

http://vblog.us/index.php

Title: Re: Topic Rating Bar
Post by: Bugo on April 02, 2012, 01:48:20 PM
Just remove/disable your top panel.
Title: Re: Topic Rating Bar
Post by: Saahilk2000 on April 02, 2012, 09:05:31 PM
Quote from: Bugo on April 02, 2012, 01:48:20 PM
Just remove/disable your top panel.


could you elaborate that a lil please?

Title: Re: Topic Rating Bar
Post by: pixeleyes on April 03, 2012, 01:05:43 AM
Quote from: pixeleyes on March 28, 2012, 11:53:50 AM
User can do rating.

But mini stars doesn't show on post category during logged-in session.

Only appears when log out.

Any idea how to fix this problem?

Any help .....
Title: Re: Topic Rating Bar
Post by: Bugo on April 03, 2012, 02:59:37 AM
Have you other jQuery mods? Which of them are work only for registered users?
Title: Re: Topic Rating Bar
Post by: MESWEB on April 13, 2012, 05:50:15 AM
Hi BUGO
What means this error? From Guest
Quote
http://yoump3.pl/index.php?action=rating
8: Undefined index: url
Plik: /home/messiah/public_html/Themes/default/TopicRating.template.php (wap2_below sub template - eval?)
Linia: 1516
Title: Re: Topic Rating Bar
Post by: Bugo on April 13, 2012, 08:25:28 AM
It's nothing serious. Install a new version, 0.7.1
Title: Re: Topic Rating Bar
Post by: lazylivin on April 13, 2012, 08:16:17 PM
I am getting this message after installation. Had to delete Subs-TopicRating.php to bring forum back online. Any ideas?

Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /homepages/7/d162731726/htdocs/forum/Sources/Subs-TopicRating.php on line 322
Title: Re: Topic Rating Bar
Post by: Bugo on April 13, 2012, 10:09:26 PM
Replace this
foreach ($temp as &$check)
with
foreach ($temp as $check)
Title: Re: Topic Rating Bar
Post by: nixlike on April 16, 2012, 03:34:29 PM
Hi Bugo,

first off let me say thank you big time for this modification, I've been waiting a long time for this.
If you dont mind I like to change something for my own forum.

The initial behavior of this mod is: vote in a thread you didn't start and have your selection shown in the boardindex and in the thread itself.

Now lets say I was a bit hasty on my decission or maybe I'm a different opinion and want to change the rating I already selected - in my case it doesnt work. I just cant change any rating I have done for a thread but would like to change the rating. Would you be so kind and point me into the right direction what code parts to change if you are ok with that?

Basically the mod just rocks, love it :)
Title: Re: Topic Rating Bar
Post by: lazylivin on April 16, 2012, 10:45:01 PM
Quote from: Bugo on April 13, 2012, 10:09:26 PM
Replace this
foreach ($temp as &$check)
with
foreach ($temp as $check)

That worked, Thank you for great Mod

I am getting this in the error log.

8: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Argument is not a stringFile: /homepages/7/d162731726/htdocs/forum/Sources/Subs-TopicRating.php
Line: 104

This is line 104
$users = unserialize($users);
Title: Re: Topic Rating Bar
Post by: Bugo on April 17, 2012, 03:47:44 AM
@nixlike, this is not my solution. See Unobtrusive AJAX Star Rating Bar (http://masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/) for details.

@lazylivin, try replace that line (104) with this:
$users = @unserialize($users);
Title: Re: Topic Rating Bar
Post by: nixlike on April 17, 2012, 12:20:45 PM
Hi again Bugo and thank you for your reply. That means there is nothing you can do to help me out? Has nobody ever wanted to correct a misplaced rating and kind of "overwrite" the first dropped rating? Looked into the Star Rating AJAX package already but that confuses me even more to be honest...

//edit
I guess this is part of the code you wrote for the Top Rating Bar from your package



for ($ncount = 1; $ncount <= $context['rating_bar']['units']; $ncount++)
if (empty($context['rating_bar']['voted']))
echo '
<li><a href="' . $scripturl . '?action=rate;stars=' . $ncount . ';topic=' . $context['current_topic'] . ';scale=' . $context['rating_bar']['units'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . $rates[$ncount-1] . '" class="r' . $ncount . '-unit rater" rel="nofollow">' . $ncount . '</a></li>';
$ncount = 0;


the line checking if the rating_bar parameter voted is set already is the one that prevents already dropped ratings to be newly rated once more. Even if that line is being removed, so the check wont be executed and the stars are clickable and moving again, a click results into an error page saying "Can't load template 'main'".
Title: Re: Topic Rating Bar
Post by: Ascot on April 18, 2012, 06:21:32 PM
Is there a way to make a stats block for simple portal of this mod?-
Like "Most rated topics" or something similar (?

thanks in advance.
Title: Re: Topic Rating Bar
Post by: Anthems on April 19, 2012, 02:02:58 PM
Quote from: nixlike on April 16, 2012, 03:34:29 PM
Hi Bugo,

first off let me say thank you big time for this modification, I've been waiting a long time for this.
If you dont mind I like to change something for my own forum.

The initial behavior of this mod is: vote in a thread you didn't start and have your selection shown in the boardindex and in the thread itself.

Now lets say I was a bit hasty on my decission or maybe I'm a different opinion and want to change the rating I already selected - in my case it doesnt work. I just cant change any rating I have done for a thread but would like to change the rating. Would you be so kind and point me into the right direction what code parts to change if you are ok with that?

Basically the mod just rocks, love it :)
It's one of the tweaks Bugo could do for us. It would only make this mod better not worst.
Being able to change the vote and being able to vote own topics would be excellent features. And it would  be even greater if the ratings could be shown at the boards and not only inside the topics. We have that option but it does not work.

Come on Bugo  ;D
Title: Re: Topic Rating Bar
Post by: nixlike on April 21, 2012, 05:44:25 AM
Anthems, the icons are being shown on boards if the option is activated. Mine runs even on a modified default theme. In general I share the same opinion with you regarding the two mentioned features. That would be really cool to have :)
Title: Re: Topic Rating Bar
Post by: Tubilok on April 21, 2012, 08:30:39 AM
I got this after upgrading from version 0.7.1 to 0.7.2.

Error Type: Critical

Wrong value type sent to the database. Array of integers expected. (ignore_boards)
Function: rating_top
Archivo: /home/forum/public_html/Sources/Subs-TopicRating.php
Línea: 269

252: $query = $smcFunc['db_query']('', '
253: SELECT tr.id, tr.total_votes, tr.total_value, ms.subject, b.id_board, b.name, m.id_member, m.id_group, m.real_name, mg.group_name
254: FROM {db_prefix}topic_ratings AS tr
255: LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = tr.id)
256: LEFT JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
257: LEFT JOIN {db_prefix}boards AS b ON (b.id_board = ms.id_board)
258: LEFT JOIN {db_prefix}members AS m ON (m.id_member = t.id_member_started)
259: LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = m.id_group)
260: WHERE m.id_member != 0' . (empty($ignore_boards) ? '' : '
261: AND b.id_board NOT IN ({array_int:ignore_boards})') . '
262: AND {query_wanna_see_board}
263: AND {query_see_board}
264: ORDER BY tr.total_votes DESC
265: LIMIT ' . $limit,
266: array(
267: 'ignore_boards' => $ignore_boards
268: )
==>269: );


EDIT: Solved.
Title: Re: Topic Rating Bar
Post by: MESWEB on April 21, 2012, 03:13:39 PM
Bugo can You write new post with new version and what's new in current version?
Title: Re: Topic Rating Bar
Post by: nixlike on April 23, 2012, 03:10:12 AM
Might be interesting to know whats new in version 0.7.2. Meanwhile I tried to get some insight on the mod regarding the ability to vote again but I see now whats the point in this. Once voted, the stars you voted will be applied to the current vote count in the database while the user ids are being put into the database as well - but totally separated. Whenever a vote got stored in the database, its not possible to find out which user id vote with how many stars, which is actually the important thing for a re-vote.

My coding skills are not good enough to change the entire routine in the code of this modification and neither do I think that Bugo wants this to happen but there is no other way than to rewrite the main part of this mod to get re-votes done. Having topic owners rate their own topics isn't a big deal since that requires only a small modification in the mods source code, but here again I count on Bugo to implement an option to turn it off or on.

Either that or hopefully someone else will come up with a proper topic rating modification. Please see for those important parts in this modification Bugo, it's not just me who is highly interested in this mod. Would donations help you to continue development?
Title: Re: Topic Rating Bar
Post by: MESWEB on April 27, 2012, 04:49:10 PM
Where is my "Display mini-rating on the message index"
i have 2 custom template:
First is working fine
Second have missing "mini-rating"
Title: Re: Topic Rating Bar
Post by: Alb0 on April 27, 2012, 05:34:40 PM
Quote from: Ascot on April 18, 2012, 06:21:32 PM
Is there a way to make a stats block for simple portal of this mod?-
Like "Most rated topics" or something similar (?

thanks in advance.

This would actually be pretty useful. Would like to know if it's possible.
Title: Re: Topic Rating Bar
Post by: Bugo on April 27, 2012, 11:31:07 PM
MESSSIAH, are you using jQuery in the second template?
Alb0, it's possible, see this code:

global $smcFunc, $context, $modSettings, $scripturl, $txt;

$context['top_rating'] = array();
$limit = !empty($modSettings['tr_count_topics']) ? (int) $modSettings['tr_count_topics'] : 0;

$ignore_boards = array();
if (!empty($modSettings['tr_ignore_boards']))
$ignore_boards = explode(",", $modSettings['tr_ignore_boards']);
if (!empty($modSettings['recycle_board']))
$ignore_boards[] = $modSettings['recycle_board'];

$query = $smcFunc['db_query']('', '
SELECT tr.id, tr.total_votes, tr.total_value, ms.subject, b.id_board, b.name, m.id_member, m.id_group, m.real_name, mg.group_name
FROM {db_prefix}topic_ratings AS tr
LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = tr.id)
LEFT JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}boards AS b ON (b.id_board = ms.id_board)
LEFT JOIN {db_prefix}members AS m ON (m.id_member = t.id_member_started)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = m.id_group)
WHERE m.id_member != 0' . (empty($ignore_boards) ? '' : '
AND b.id_board NOT IN ({array_int:ignore_boards})') . '
AND {query_wanna_see_board}
AND {query_see_board}
ORDER BY tr.total_votes DESC
LIMIT ' . $limit,
array(
'ignore_boards' => $ignore_boards
)
);

while ($row = $smcFunc['db_fetch_assoc']($query))
$context['top_rating'][$row['id']] = array(
'topic' => '<a href="' . $scripturl . '?topic=' . $row['id'] . '.0" target="_blank">' . $row['subject'] . '</a>',
'board' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0" target="_blank">' . $row['name'] . '</a>',
'author' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" target="_blank">' . $row['real_name'] . '</a>',
'group' => empty($row['id_group']) ? $txt['tr_regular_members'] : $row['group_name'],
'rating' => number_format($row['total_value'] / $row['total_votes'], 2),
'votes' => $row['total_votes']
);

$smcFunc['db_free_result']($query);

print_r($context['top_rating']);


Paste it into any PHP block and make own design for output.
Title: Re: Topic Rating Bar
Post by: MESWEB on April 28, 2012, 06:03:18 AM
Quote from: Bugo on April 27, 2012, 11:31:07 PM
MESSSIAH, are you using jQuery in the second template?
I have Extreme6 Final and more custom templates. This mod i working only with Redzone88 template.
Title: Re: Topic Rating Bar
Post by: Bugo on April 28, 2012, 12:11:56 PM
Send me a link to your forum.
Title: Re: Topic Rating Bar
Post by: MESWEB on April 28, 2012, 01:37:50 PM
This is my site. If You wish i creat for You account to testing templates
http://yoump3.pl (http://yoump3.pl)
Title: Re: Topic Rating Bar
Post by: Bugo on April 28, 2012, 09:27:46 PM
Well, I noticed you are using some spoiler mod with jQuery 1.6.2. It's a very old version. Try remove it. My mod uses jQuery 1.7.2, the latest.
Title: Re: Topic Rating Bar
Post by: nixlike on April 29, 2012, 03:58:53 AM
Very sad to see that you aren't even interested in replying to important contents regarding your own mod Bugo. So be it, I better stay without a half working mod than using it and be limited in its functions, plus I don't have to come up with uncomprehensive reasons for board members why logic functions are missing.
Title: Re: Topic Rating Bar
Post by: MESWEB on April 29, 2012, 04:20:41 AM
Quote from: Bugo on April 28, 2012, 09:27:46 PM
Well, I noticed you are using some spoiler mod with jQuery 1.6.2. It's a very old version. Try remove it. My mod uses jQuery 1.7.2, the latest.
Problem Solved! I delete template and install it again. Working fine. Thanks for help - BUGO :)
Title: Re: Topic Rating Bar
Post by: jaisi on April 29, 2012, 06:01:28 PM
I'am getting this Error please help me how to fix this Error ***(/Themes/default/languages/TopicRating/).
Title: Re: Topic Rating Bar
Post by: elmenda on May 03, 2012, 06:50:12 AM
Hey. Would it be possible to tell me I can com make the stars appear in the title bar instead of the default mode?

thanks
Title: Re: Topic Rating Bar
Post by: nixlike on May 04, 2012, 12:26:25 AM
Dont hope for changes elmenda as this mod seems to be a mod without support. If you read backwards, you can see that I tried to get some information as well as others did but either no response or no proper response one is supposed to work with from the mod creator. Sad, but true.
Title: Re: Topic Rating Bar
Post by: elmenda on May 04, 2012, 06:42:27 PM
is very important please.

thanks
Title: Re: Topic Rating Bar
Post by: elmenda on May 09, 2012, 03:29:21 PM
:(
Title: Re: Topic Rating Bar
Post by: mkress on May 21, 2012, 01:23:32 PM
rating for guests would be great
Title: Re: Topic Rating Bar
Post by: MESWEB on May 21, 2012, 01:29:04 PM
Quote from: mkress on May 21, 2012, 01:23:32 PM
rating for guests would be great
I think this same.
Title: Re: Topic Rating Bar
Post by: Arantor on May 21, 2012, 01:35:41 PM
And it would be unreliable and easy to spam because there's no reliable way of tracking guests' votes.
Title: Re: Topic Rating Bar
Post by: MESWEB on May 21, 2012, 01:40:52 PM
What spam??? You mean spamers votes allways 1 star??  I don't need track guests votes.
Title: Re: Topic Rating Bar
Post by: mkress on May 21, 2012, 01:45:45 PM
Cookie prevention should be enough. Guest voting should be enabled separatly by settings
Title: Re: Topic Rating Bar
Post by: Arantor on May 21, 2012, 01:57:25 PM
That's the thing, guest voting cannot be made reliable. Either you limit it by IP address, which means it's unreliable because one IP address is not the same as one computer (e.g. at my old company, we only had two IP addresses for the entire large company), or you do it by cookies which aren't reliable because someone can delete them. (Plus all the issues with cookies in the UK, plus the fact that it's all extra stuff you have to track)
Title: Re: Topic Rating Bar
Post by: BaghdadGhost on July 09, 2012, 08:51:59 PM
Hi Bugo,

great mod as usual. thank.

one think though, I installed the mod without any errors on smf 2.0.2 custom theme. the mini-bar on messageindex only appears when default theme! I moved all included folders also to custom theme (as below) but it did not work. rating and other features are ok. just the mini-bar is not visible in custom theme?

Move the included directory "default/css" to "./Themes/custom".
Move the included directory "default/images" to "./Themes/custom".
Move the included directory "default/languages" to "./Themes/custom".
Move the included directory "default/scripts" to "./Themes/custom".
Move the included file "default/TopicRating.template.php" to "./Themes/custom".

thanks in advance
Title: Re: Topic Rating Bar
Post by: Bugo on July 10, 2012, 04:22:20 AM
What theme?
Title: Re: Topic Rating Bar
Post by: Bugo on September 28, 2012, 01:06:52 PM
Quote from: igirisjin on September 28, 2012, 12:01:38 PM
Nice, but it doesnt work if topics are created through the calendar as events ... would be nice if that worked.
Quote from: igirisjin on September 28, 2012, 12:10:01 PM
Doesn't work on sticky topics?
Why doesn't work? Any example please, with links to pages on your forum.
Title: Re: Topic Rating Bar
Post by: OCJ on September 28, 2012, 11:44:22 PM
Ah, good news... I will take that back. It is not displaying on posts I make.

I added event posts for a couple of other users and use another account  for testing 'Midan' > Admin.
Often I post stuff with that using the mod 'post as alternate user'. These posts it isnt displaying the topic rating as I posted them.
Title: Re: Topic Rating Bar
Post by: Bugo on September 29, 2012, 12:01:59 AM
I can't reproduce this problem on my site.

Have you set up permissions for all groups?
Did you know authors cannot rate own topics? - It's the modification's rule.
Title: Re: Topic Rating Bar
Post by: OCJ on September 29, 2012, 02:56:24 AM
Thats what I was saying in my post...

Using the mod ' post as alternate user', there are posts there I attributed to other users (but i posted in their name). But topic rating still knows I posted them.

This mod
http://custom.simplemachines.org/mods/index.php?mod=2626

No problem, working fine.
Title: Re: Topic Rating Bar
Post by: Apllicmz on October 14, 2012, 03:05:57 PM
Dont forget to add portuguese files

Title: Re: Topic Rating Bar
Post by: Bugo on October 14, 2012, 05:26:39 PM
Muito obrigado.
Title: Re: Topic Rating Bar
Post by: novill on October 23, 2012, 02:39:54 PM
I have installed the new version of topic rating bar, and have noticed that the language file is a bit different. I have translated the new one to hungarian, and attached.
Title: Re: Topic Rating Bar
Post by: Bugo on October 23, 2012, 03:06:03 PM
Nagyon szépen köszönöm.
Title: Re: Topic Rating Bar
Post by: novill on October 23, 2012, 03:18:59 PM
Ohh you are a multi language guy, it brings a smile to my face. ;D
Title: Re: Topic Rating Bar
Post by: rizkirprod on October 30, 2012, 06:26:40 PM
everythink is great, i love this mod. but i have some question. the best topic is show one topic, so how to make The Best Topic to 5 Topic not only one topic?

thanks
Title: Re: Topic Rating Bar
Post by: Xarkurai on December 02, 2012, 08:19:55 AM
What do I have to edit to actually give it another position?
Not sure where I have to search when its hooked..

Awesome Mod by the way!
Title: Re: Topic Rating Bar
Post by: N i g h t m a r e on December 22, 2012, 12:14:51 AM
This is working perfectly for me :) marvelous mod
Title: Re: Topic Rating Bar
Post by: b0t on January 01, 2013, 12:35:38 AM
Hi, this is the best mod of voting, but I want the guests to vote. I wonder where I can give permission to the guests, Thank!
Title: Re: Topic Rating Bar
Post by: Skaty on January 09, 2013, 09:41:20 PM
i'm using this mod for a while but it is not showing ratings in message index anymore. i'm not sure when it is stop showing them. i updated it for a last version but still don't show up. any suggestions ?

(http://i.imgur.com/ryvJi.png)
Title: Re: Topic Rating Bar
Post by: Bugo on January 10, 2013, 04:56:41 AM
Post any link to topic with rating.
Title: Re: Topic Rating Bar
Post by: Skaty on January 10, 2013, 09:12:24 AM
i will send it to you.
Title: Re: Topic Rating Bar
Post by: Bugo on January 10, 2013, 11:47:49 AM
You are using various versions of jQuery (1.6, 1.8.1 etc). Try disable/uninstall other mods that you have installed after the Topic Rating Bar.
Title: Re: Topic Rating Bar
Post by: Skaty on January 10, 2013, 03:31:06 PM
i try some of them but didn't show up. i uninstall it :(
Title: Re: Topic Rating Bar
Post by: Simple Site Designs on March 24, 2013, 09:28:48 PM
Hi, thanks for this mod!

I've noticed the ratings do not appear to be merged when one or more topics are merged.
Can you please let me know if this may be doable somehow?
Title: Re: Topic Rating Bar
Post by: DaRKeN_58 on March 25, 2013, 06:46:24 AM
Someone help me relocate the stars? Something similar to what the user commented elmenda:

Quote from: elmenda on May 03, 2012, 06:50:12 AM
Hey. Would it be possible to tell me I can com make the stars appear in the title bar instead of the default mode?

thanks

(http://www.simplemachines.org/community/index.php?action=dlattach;topic=464537.0;attach=202469;image)

Thank you.
Title: Re: Topic Rating Bar
Post by: vkot on April 07, 2013, 05:26:25 PM
Nice mod! :)
Can you make it so that the topics in each board be sorted by rating? (by clicking somewhere on the header, as it is for other fields)
Title: Re: Topic Rating Bar
Post by: Simple Site Designs on April 07, 2013, 06:23:55 PM
I made changes so I could do this but it was within a totally custom theme, I can have a look at what I did on the back end if you like but it did not involve changes for the default theme.
Title: Re: Topic Rating Bar
Post by: vkot on April 08, 2013, 01:45:58 PM
I am using the default theme. I can can do changes myself if I need to, but a hint from you will be very useful. A piece of code, or just some words on where I should start.

Also... has anyone hacked this so that members can change their rating at a later time? (because of a mistake, or because the topic changed quality significantly)
Title: Re: Topic Rating Bar
Post by: Simple Site Designs on April 16, 2013, 01:52:11 AM
Quote from: vkot on April 08, 2013, 01:45:58 PM
I am using the default theme. I can can do changes myself if I need to, but a hint from you will be very useful. A piece of code, or just some words on where I should start.

Hi vkot,

part of the changes I made are in the source file MessageIndex.php

I had to replace this:

// We only know these.
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post')))
$_REQUEST['sort'] = 'last_post';


With this (to make rating an accepted sort field):

// We only know these.
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post', 'rating')))
$_REQUEST['sort'] = 'last_post';


I also had to edit the actual query to include a sort by rating.

Find this:

// Sequential pages are often not optimized, so we add an additional query.
$pre_query = $start > 0;
if ($pre_query && $maxindex > 0)
{

$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t' . ($context['sort_by'] === 'last_poster' ? '
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)' : (in_array($context['sort_by'], array('starter', 'subject')) ? '
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)' : '')) . ($context['sort_by'] === 'starter' ? '
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)' : '') . ($context['sort_by'] === 'last_poster' ? '
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' : '') . '
WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
LIMIT {int:start}, {int:maxindex}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'is_approved' => 1,
'id_member_guest' => 0,
'start' => $start,
'maxindex' => $maxindex,
)
);
$topic_ids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topic_ids[] = $row['id_topic'];
}



And replace with this:

// Sequential pages are often not optimized, so we add an additional query.
$pre_query = $start > 0;
if ($pre_query && $maxindex > 0)
{

$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t' . ($context['sort_by'] === 'last_poster' ? '
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)' : (in_array($context['sort_by'], array('starter', 'subject')) ? '
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)' : '')) . ($context['sort_by'] === 'starter' ? '
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)' : '') . ($context['sort_by'] === 'last_poster' ? '
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' : '') . ($context['sort_by'] === 'rating' ? '
LEFT JOIN {db_prefix}topic_ratings AS r ON (r.id = t.id_topic)' : '') . '
WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
LIMIT {int:start}, {int:maxindex}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'is_approved' => 1,
'id_member_guest' => 0,
'start' => $start,
'maxindex' => $maxindex,
)
);
$topic_ids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topic_ids[] = $row['id_topic'];
}


You just need to somehow add the sort to the column then, and that change will need to be in your default theme MessageIndex.template.php file.

Cheers,
Josh

Edit: You will also need to alter the second query (just below the comment "// For search engine effectiveness we'll link guests differently." to include the rating table for sorting. But I reckon you can work it out, it's basically the same change as above.
Title: Re: Topic Rating Bar
Post by: deadhero on June 28, 2013, 02:08:36 AM
I get this error on error logs:

http://etkinforum.com/index.php?/index.php?action=seo4smf;u=aHR0cDovL2ZyZWFrc2hhcmUuY29tL2ZpbGVzL2xzNHIzdnd1L1RVUDIwMTIuMTIuMC4zNTAwLjE0LkZOTC5yYXIuaHRtbA==8: Undefined index: num_repliesDosya: /home/etkinforum.com/httpdocs/Themes/default/TopicRating.template.php (main sub template - eval?)


http://etkinforum.com/index.php?http://etkinforum.com/8: Undefined index: num_repliesDosya: /home/etkinforum.com/httpdocs/Themes/default/TopicRating.template.php (main sub template - eval?)
Satır: 433


http://etkinforum.com/index.php?8: Undefined index: num_repliesDosya: /home/etkinforum.com/httpdocs/Themes/default/TopicRating.template.php (main sub template - eval?)
Satır: 433


http://etkinforum.com/index.php?8: Undefined index: viewer_textDosya: /home/etkinforum.com/httpdocs/Themes/default/TopicRating.template.php (main sub template - eval?)
Satır: 170
Title: Re: Topic Rating Bar
Post by: JerryGraf on October 23, 2013, 08:07:11 PM
I installed  http://custom.simplemachines.org/mods/index.php?mod=3236 (which I believe is still state of the art). I'm running 2.0.4, and can see no sign of the mod, either on the board itself or in the admin console. The instructions I used to install are these:

Move the included directory "default/css" to "./Themes/default".
Move the included directory "default/images" to "./Themes/default".
Move the included directory "default/languages" to "./Themes/default".
Move the included directory "default/scripts" to "./Themes/default".
Move the included file "default/TopicRating.template.php" to "./Themes/default".
Move the included file "core/Subs-TopicRating.php" to "./Sources".


Did I miss something?

Thanks,

George
Title: Re: Topic Rating Bar
Post by: Arantor on October 23, 2013, 08:15:05 PM
Yes you did.

As per http://custom.simplemachines.org/mods/index.php?action=parse;mod=3236;attach=209740;smf_version=2.0.4 you need to execute both database.php and hooks.php to do post-install configuration for the mod. Which is generally why mods should be unpacked from the package manager wherever possible because it will do that for you.

Also please note that there are two security patches since 2.0.4 to be installed.
Title: Re: Topic Rating Bar
Post by: JerryGraf on October 23, 2013, 09:51:11 PM
Thanks so much for the reply. Can you advise what's required to "execute" these files? Many thanks!
Title: Re: Topic Rating Bar
Post by: Arantor on October 23, 2013, 09:53:29 PM
I don't see why you need to be doing any of this manually when the SMF Package Manager (more: Package Manager (http://wiki.simplemachines.org/smf/Packages)) will do it for you in the first place...

Failing that, unpack the files from the zip archive, upload them to your forum where SSI.php is then visit them in your browser.
Title: Re: Topic Rating Bar
Post by: JerryGraf on October 24, 2013, 10:28:17 AM
Many thanks. I just started with this and was not aware of the package manager.

Thanks again for the quick replies.
Title: Re: Topic Rating Bar
Post by: Alpay on October 28, 2013, 11:55:04 AM
Quote from: Simple Site Designs on April 16, 2013, 01:52:11 AM
Quote from: vkot on April 08, 2013, 01:45:58 PM
I am using the default theme. I can can do changes myself if I need to, but a hint from you will be very useful. A piece of code, or just some words on where I should start.

Hi vkot,

part of the changes I made are in the source file MessageIndex.php

I had to replace this:

// We only know these.
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post')))
$_REQUEST['sort'] = 'last_post';


With this (to make rating an accepted sort field):

// We only know these.
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post', 'rating')))
$_REQUEST['sort'] = 'last_post';


I also had to edit the actual query to include a sort by rating.

Find this:

// Sequential pages are often not optimized, so we add an additional query.
$pre_query = $start > 0;
if ($pre_query && $maxindex > 0)
{

$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t' . ($context['sort_by'] === 'last_poster' ? '
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)' : (in_array($context['sort_by'], array('starter', 'subject')) ? '
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)' : '')) . ($context['sort_by'] === 'starter' ? '
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)' : '') . ($context['sort_by'] === 'last_poster' ? '
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' : '') . '
WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
LIMIT {int:start}, {int:maxindex}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'is_approved' => 1,
'id_member_guest' => 0,
'start' => $start,
'maxindex' => $maxindex,
)
);
$topic_ids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topic_ids[] = $row['id_topic'];
}



And replace with this:

// Sequential pages are often not optimized, so we add an additional query.
$pre_query = $start > 0;
if ($pre_query && $maxindex > 0)
{

$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t' . ($context['sort_by'] === 'last_poster' ? '
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)' : (in_array($context['sort_by'], array('starter', 'subject')) ? '
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)' : '')) . ($context['sort_by'] === 'starter' ? '
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)' : '') . ($context['sort_by'] === 'last_poster' ? '
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' : '') . ($context['sort_by'] === 'rating' ? '
LEFT JOIN {db_prefix}topic_ratings AS r ON (r.id = t.id_topic)' : '') . '
WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
LIMIT {int:start}, {int:maxindex}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'is_approved' => 1,
'id_member_guest' => 0,
'start' => $start,
'maxindex' => $maxindex,
)
);
$topic_ids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topic_ids[] = $row['id_topic'];
}


You just need to somehow add the sort to the column then, and that change will need to be in your default theme MessageIndex.template.php file.

Cheers,
Josh

Edit: You will also need to alter the second query (just below the comment "// For search engine effectiveness we'll link guests differently." to include the rating table for sorting. But I reckon you can work it out, it's basically the same change as above.

Hello ;

messages.index.template ;

add ?

<th class="t"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=rating', $context['sort_by'] == 'rating' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['rating'], $context['sort_by'] == 'rating' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>


did not ?
Title: Re: Topic Rating Bar
Post by: MaccabeeY on December 25, 2013, 02:59:17 PM
Bugo,

Very nice mod!!! Good work.

Have I have identified bugs that generate Log Errors.  If seems to be centered around "permissions".

The main error generated is:

--
http://forum.myplace.com/index.php?/topic,4.0.html
8: Undefined index: message
File: /home/.../forum/Themes/default/TopicRating.template.php (main sub template - eval?)
Line: 82
--

The bug is "serious" in the sense that it seems to generates Log Errors under at least two conditions:
1) EVERY time any ADMINISTATOR reads ANY post, this "floods" the error log
and
2) EVERY time the author of a post reads his own post

These errors appear to be generated regardless of how permissions are configured.  I investigated for a bit and it looks like the bug may be centered around the use or testing of the "$context['proper_user']" value.

To avoid flooding the Error Log, for now I will turn off "Top Ratings Bar".  I look forward to the solution.
Thx,
Edward
Title: Re: Topic Rating Bar
Post by: cwl on January 20, 2014, 04:03:51 AM
Quote from: Ascot on February 04, 2012, 01:18:08 PM
Hi there, i've install this mod... but nothing seems to happen D:
i mean, there isn't stars at topics, neither inside them.
Is there something i forgot to do?

I have the same issue. androiderrors com - latest version of smf. after installing topic rating bar, nothing happens. Installation was successful. The description column was blank on the install screen. Any ideas?
Title: Re: Topic Rating Bar
Post by: Shadight on September 20, 2014, 05:00:41 PM
Quote from: pixeleyes on March 28, 2012, 11:53:50 AM
User can do rating.

But mini stars doesn't show on post category during logged-in session.

Only appears when log out.

Any idea how to fix this problem?

Hello, as pixeleys, i have this same problem.

I work on local forum. At first, i was believe that maybe this mod has some conflict with other mod.
I have started a new clean installation and i have the same problem. The mini-stars doesn't show on post category during logged-in session.

For information, i use this theme (in defauts theme no problem to see mini stars but when i'm logged in with fumes, i can't see them).

http://custom.simplemachines.org/themes/index.php?lemma=2697

(sorry for my english)

Thank you for any help
Title: Re: Topic Rating Bar
Post by: Ian Mc on April 07, 2016, 11:18:14 AM
I know this is a very old thread, but I wondered if anyone found or made the code to put the most popular topics into a Simple Portal box?

This mod is exactly what I need but I need that bit of code!! I saw a few people asking for it earlier in the thread so I'm hoping someone sorted it !!
Title: Re: Topic Rating Bar
Post by: OCJ on April 07, 2016, 01:07:03 PM
You should ask over at simple portal. Some people there will do it as custom coding... they might ask for a fee if its a personal customization request.
Title: Re: Topic Rating Bar
Post by: Ian Mc on April 07, 2016, 01:52:25 PM
Quote from: igirisjin on April 07, 2016, 01:07:03 PM
You should ask over at simple portal. Some people there will do it as custom coding... they might ask for a fee if its a personal customization request.
That's a very good suggestion. I'll give them a try.
Title: Re: Topic Rating Bar
Post by: Biology Forums on February 23, 2019, 12:51:58 PM
On this line:

if (!empty($context['current_topic']) && empty($context['current_action']) && empty($board_info['error']) && empty(strpos($_SERVER['REQUEST_URI'], ';')))

I'm getting the error:

PHP Fatal error:  Can't use function return value in write context in /home/***/public_html/Sources/Class-TopicRating.php on line 117

Presumably because of this part: empty(strpos($_SERVER['REQUEST_URI'], ';'))

because when I remove it, it works. What's wrong?

Title: Re: Topic Rating Bar
Post by: Arantor on February 23, 2019, 01:04:16 PM
Well, you're stuck on PHP below 5.5 where this syntax became legal.

I guess you could probably rewrite it as:
if (!empty($context['current_topic']) && empty($context['current_action']) && empty($board_info['error']) && strpos($_SERVER['REQUEST_URI'], ';') === false)

but I wouldn't want to encourage you to stay on a version of PHP with known vulnerabilities.
Title: Re: Topic Rating Bar
Post by: Biology Forums on February 23, 2019, 02:24:01 PM
I didn't know this was designed for >5.5.

I decided to uninstall it since it doesn't have built-in guest voting. I do realize guest voting potentially leads to spam, but it does engage a larger population of visitors. Has guest posting been implemented by anyone anyway?
Title: Re: Topic Rating Bar
Post by: Arantor on February 23, 2019, 02:41:13 PM
I wouldn't say "designed for > 5.5" but a by product of the author's level of PHP knowledge at the time it was written.

SMF can do guest posting out of the box but it leads to spam and no one has really nailed a good way to deal with that (2.0 let's you expose all the CAPTCHA stuff including plugins to guest posting, but almost everyone I know pushes for registration instead)
Title: Re: Topic Rating Bar
Post by: Biology Forums on February 24, 2019, 12:05:06 AM
I was referring to the rating permission for this mod, there isn't the option to allow guest rating :(
Title: Re: Topic Rating Bar
Post by: Bigguy on March 02, 2019, 01:57:14 PM
I installed this on smfhelper.com and it does not show up anywhere. Any ideas. ??
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 19, 2019, 04:49:43 PM
Quote from: Arantor on February 23, 2019, 01:04:16 PM
Well, you're stuck on PHP below 5.5 where this syntax became legal.

I guess you could probably rewrite it as:
if (!empty($context['current_topic']) && empty($context['current_action']) && empty($board_info['error']) && strpos($_SERVER['REQUEST_URI'], ';') === false)

but I wouldn't want to encourage you to stay on a version of PHP with known vulnerabilities.

Going back to this, when I use the code provide, the topic bar doesn't appear. Only if I remove the part

&& strpos($_SERVER['REQUEST_URI'], ';') === false

Does it show. What's going on?
Title: Re: Topic Rating Bar
Post by: Arantor on March 19, 2019, 04:54:29 PM
What URL are you using it with?
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 19, 2019, 05:11:35 PM
Quote from: Arantor on March 19, 2019, 04:54:29 PM
What URL are you using it with?

A topic url like this: https://URL.com/index.php?topic=1910840.0
Title: Re: Topic Rating Bar
Post by: Arantor on March 19, 2019, 05:16:08 PM
And not the ;topicseen version that SMF habitually uses, huh?
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 19, 2019, 05:40:44 PM
No, nothing with a semi-colon

Is that required?
Title: Re: Topic Rating Bar
Post by: Arantor on March 19, 2019, 05:47:37 PM
No, it's just frequently a thing SMF does, which is why that code is even there.
Title: Re: Topic Rating Bar
Post by: Bugo on March 20, 2019, 01:00:22 AM
Try a new version from Github: https://github.com/dragomano/Topic-Rating-Bar
Title: Re: Topic Rating Bar
Post by: RockLee on March 20, 2019, 08:46:54 AM
I leave here also the translation in case someone wants it to the Latin Spanish :D!


Regards!
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 20, 2019, 10:24:56 AM
Quote from: Bugo on March 20, 2019, 01:00:22 AM
Try a new version from Github: https://github.com/dragomano/Topic-Rating-Bar

Thank you. This one works out of the box without any modifications.

Quick question to the author:

After selecting a star, is it possible for you to activate the "Loading" div that comes stock with SMF? This will show the end-user that their selection has been made.
Title: Re: Topic Rating Bar
Post by: Bugo on March 20, 2019, 11:22:47 AM
Yes. Added in the update.
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 20, 2019, 11:51:19 AM
The one I downloaded or should I download it again? Because it doesn't show when I click a star
Title: Re: Topic Rating Bar
Post by: ORIONzitos on March 20, 2019, 11:55:26 AM
PT-BR Translation \o  8)

Total of translations: 7
Title: Re: Topic Rating Bar
Post by: Hatshepsut on March 20, 2019, 02:13:51 PM
I just have installed Topic Rating Bar 1.2 on my SMF 2.1 forum. Installation was succesful, the settings in admin panel are OK, but I don't see rating bar in any topic.

Click => (https://i.postimg.cc/cgJY6zYZ/Topic-Rating-Bar.jpg) (https://postimg.cc/cgJY6zYZ)

I use Tinyportal and some other mods - Socialize, SMF Gallery, Simple Audio Video Embedder, and GDPR Helper.

Forum version: SMF 2.1 RC1 (more detailed)
Current SMF version: SMF 2.1 RC1
GD version: bundled (2.1.0 compatible)
MySQLi engine: MySQL
MySQLi version: 5.5.59-cll
PHP: 7.2.14 (more detailed)
Server version: Apache
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 20, 2019, 02:16:47 PM
Have you tried this link?

Quote from: Bugo on March 20, 2019, 01:00:22 AM
Try a new version from Github: https://github.com/dragomano/Topic-Rating-Bar
Title: Re: Topic Rating Bar
Post by: Bigguy on March 20, 2019, 02:31:04 PM
It's the same for me. Nothing shows on 2.1 I just tried the one from GH
Title: Re: Topic Rating Bar
Post by: Bugo on March 20, 2019, 03:57:29 PM
Try to update Class-TopicRatingBar.php, trb_styles.css and TopicRatingBar.template.php from the develop branch: https://github.com/dragomano/Topic-Rating-Bar/tree/develop, especially for SMF 2.1 RC1.
Title: Re: Topic Rating Bar
Post by: Hatshepsut on March 26, 2019, 12:30:30 AM
I think, there is a collision between Topic Rating Bar and Tinyportal.
I have installed Topic Rating Bar on my other SMF 2.1 test forum and it works fine. After installing of Tinyportal (version 1.6.3), rating bars disappear.
And after uninstalling of Tinyportal, rating bars appear again.
Title: Re: Topic Rating Bar
Post by: Bugo on March 28, 2019, 02:47:26 AM
Test v1.3 from Github => https://github.com/dragomano/Topic-Rating-Bar/tree/develop (SMF 2.1) or https://github.com/dragomano/Topic-Rating-Bar/tree/master (SMF 2.0).
Title: Re: Topic Rating Bar
Post by: Bigguy on March 28, 2019, 07:16:30 AM
It works now with 2.1. Looks good. :)
Title: Re: Topic Rating Bar
Post by: Hatshepsut on March 28, 2019, 10:01:24 AM
Yes, the new version 1.3 works with SMF 2.1 RC1 and Tinyportal :)
Title: Re: Topic Rating Bar
Post by: Biology Forums on March 28, 2019, 10:02:27 AM
What's new on 1.3?
Title: Re: Topic Rating Bar
Post by: njtweb on March 28, 2019, 10:24:02 AM
I installed on 2.0.15  default curve. I applied to only one forum and set both registered users and moderators to be able to change rating.

I don't see this rating bar anywhere as a my test registered user.
Title: Re: Topic Rating Bar
Post by: njtweb on March 28, 2019, 10:50:48 AM
Nevermind, uninstalled, not worth the time to research to find out why it doesn't work.
Title: Re: Topic Rating Bar
Post by: Bugo on March 28, 2019, 11:14:12 AM
Quote from: Study Force on March 28, 2019, 10:02:27 AM
What's new on 1.3?

Title: Re: Topic Rating Bar
Post by: njtweb on March 28, 2019, 11:26:38 AM
I don't know if v1.3 is supposed to be live on the mod site but it's not. I downloaded the 2.0.x version this morning and installed. It's 1.2.
Title: Re: Topic Rating Bar
Post by: dodos26 on December 29, 2019, 08:01:37 AM
Bugs on 2.0.15:
Mods and admin cant change rate.
If there is any rate, you dont see your click rate.
If there is any rate, you can clikc your rate and dont see ur click. Must refresh web.
To do:
Users can change rate.
Title: Re: Topic Rating Bar
Post by: aegersz on May 14, 2021, 09:16:06 AM
all systems are PHP 7.1.33, SMF 2.0.18

I have two almost identical SMF systems (one for live and one for dev) and this is what is going on with me:

Live with all my mods: Version 1.4.1 isn't highlighting the stars as I hover over them.
Live with all my mods: Version 0.8.2 works
Live with no mods: Version 1.4.1 works
Dev: after mirroring, Version 1.4.1 works only after a reinstall.

What (issue or mod) could be getting in the way ?
Title: Re: Topic Rating Bar
Post by: aegersz on May 14, 2021, 02:46:38 PM
Solved ! - I just had to clear the cache only on each browser.
Title: Re: Topic Rating Bar
Post by: aegersz on May 16, 2021, 06:24:28 AM
I got 3 errors in a row for trb_rate ... what does https://sitename/index.php?action=trb_rate do ?

... and should it come back with a blank page ?
Title: Re: Topic Rating Bar
Post by: Bugo on May 16, 2021, 12:24:47 PM
Can you post a screenshot of these errors?
Title: Re: Topic Rating Bar
Post by: aegersz on May 16, 2021, 12:42:33 PM
sure ...
Title: Re: Topic Rating Bar
Post by: Bugo on May 17, 2021, 10:19:50 AM
Fixed. Install v1.4.2
Title: Re: Topic Rating Bar
Post by: aegersz on May 18, 2021, 08:16:00 PM
Thanks