News:

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

Main Menu

Topic Rating Bar

Started by Bugo, January 05, 2012, 11:13:27 PM

Previous topic - Next topic

pixeleyes

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 .....

Bugo

Have you other jQuery mods? Which of them are work only for registered users?

MESWEB

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

Bugo

It's nothing serious. Install a new version, 0.7.1

lazylivin

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

Bugo

Replace this
foreach ($temp as &$check)
with
foreach ($temp as $check)

nixlike

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 :)

lazylivin

#67
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);

Bugo

@nixlike, this is not my solution. See Unobtrusive AJAX Star Rating Bar for details.

@lazylivin, try replace that line (104) with this:
$users = @unserialize($users);

nixlike

#69
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'".

Ascot

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.

Anthems

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

nixlike

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 :)

Tubilok

#73
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.

MESWEB

Bugo can You write new post with new version and what's new in current version?

nixlike

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?

MESWEB

Where is my "Display mini-rating on the message index"
i have 2 custom template:
First is working fine
Second have missing "mini-rating"

Alb0

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.

Bugo

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.

MESWEB

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.

Advertisement: