vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Show Thread Enhancements - [AJAX] Threads Rating (https://vborg.vbsupport.ru/showthread.php?t=221364)

mad@Max 08-19-2009 10:00 PM

[AJAX] Threads Rating
 
1 Attachment(s)
Description:
This is a rewritten version of this version https://vborg.vbsupport.ru/showthread.php?t=185117. Functionality is same, but working it little bit by another way:)

Difference between versions 1.x and 2.x:

- much better code (php, js, html)
- eliminated one query on showthread

Compatibility:
3.7.x - 3.8.x

Features:
  • choose forums, where a rating threads to display it is necessary or not necessary
  • view rating statistic
    • choose groups with view permission
    • choose groups with view permission
  • allow/deny rate self threads
  • allow choose 10 point system
  • navigation by page raters
  • fully realisation with AJAX

Install:

Extract all files from folder "Upload" in forum root directory

Find in file threadrate.php on youre server:

PHP Code:

        $xml->add_tag('voteavg'process_replacement_vars("$vbphrase[rating]: <img class=\"inlineimg\" src=\"$stylevar[imgdir_rating]/rating_$thread[rating].gif\" alt=\"" construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\" border=\"0\" />")); 

Replace with:

PHP Code:

        $currate = ($thread['voteavg']*25 px);
        
$xml->add_tag('voteavg'process_replacement_vars("<table cellpadding=\"$stylevar[cellpadding]\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"right\" width=\"45%\" nowrap=\"nowrap\"><div><strong>$vbphrase[trate_currate]</strong></div></td><td align=\"left\" width=\"55%\" nowrap=\"nowrap\"><ul class=\"star-rating\" title=\"" construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\"><li class=\"current-rating\" style=\"width:$currate;\"></li></td></tr></table>")); 

Using the Product Manager, upload the Product that came with this modification.

###############################

For ten point system:

Open: threadrate.php

Find:

PHP Code:

if ($vbulletin->GPC['vote'] < OR $vbulletin->GPC['vote'] > 5

Replace with:

PHP Code:

if ($vbulletin->GPC['vote'] < OR $vbulletin->GPC['vote'] > 10

--------------------------------------------------------

Open: /includes/class_dm_threadrate.php

Find:

PHP Code:

var $max_vote 5

Replace with:

PHP Code:

var $max_vote 10

###############################

Admincp > Plugins and Products > Manage Products > [Add/Import Product] >

product-trate.xml

Update:

Uninstall old mod and replace all files with newest, import product (latest)

Enjoy!

DEMO http://www.youtube.com/watch?v=A3zRjkjQD6k

PS Sorry, the screenshots in russian, but I think, and so everything is clear:)

Click Install, if you like this mod:)

snowlion 08-20-2009 08:10 PM

Database error in vBulletin 3.8.2:
Invalid SQL:
SELECT *
FROM threadrate
WHERE threadid = intval(1);
MySQL Error : FUNCTION lonely_forum.intval does not exist
Error Number : 1305
Request Date : Thursday, August 20th 2009 @ 04:09:03 PM
Error Date : Thursday, August 20th 2009 @ 04:09:03 PM
Script : http://www.bentinhyeu.info/forum/thr...php?threadid=1
Referrer :
IP Address : 117.2.10.33
Username : Administrator
Classname : vB_Database
MySQL Version : 5.1.30


i upgraded and database error when click Edit/View Rating
:D

trotskid 08-20-2009 09:04 PM

Version 1.5.2 (3.7.x) runs well on 3.8.3 :). Which is the difference between v2.0?

mad@Max 08-20-2009 10:58 PM

snowlion, little fix. Archive is reuploaded. Just replace threadratinginfo.php
trotskid, how i said in first post, visually, all remained as before, but almost of code rewritten include php, javascript and html. Javascript rewritten to YUI, almost php code replaced into threadratinginfo.php and much better to-html :)

mad@Max 08-20-2009 11:43 PM

Another fix:) Replace same file.

trotskid 08-21-2009 12:21 AM

Update then and works fine, but doesn?t appear the 10 stars with the ten point system.

http://img38.imageshack.us/img38/8972/tr1t.jpg

JacquiiDesigns 08-21-2009 12:40 AM

ha! I've just installed the previous version (3.7.x)
What are the differences between versions? Is this an upgraded code? Are there any enhancements/features for this version?

Thanks for the share.

Jacquii.

trotskid 08-21-2009 12:44 AM

Quote:

Originally Posted by JacquiiCooke (Post 1871339)
ha! I've just installed the previous version (3.7.x)
What are the differences between versions? Is this an upgraded code? Are there any enhancements/features for this version?

Thanks for the share.

Jacquii.

--------------

Quote:

Originally Posted by trotskid (Post 1871267)
Which is the difference between v2.0?

Quote:

Originally Posted by mad@Max (Post 1871301)
how i said in first post, visually, all remained as before, but almost of code rewritten include php, javascript and html. Javascript rewritten to YUI, almost php code replaced into threadratinginfo.php and much better to-html :)


trotskid 08-21-2009 01:42 AM

Well, I've installed the Thread rating out of 10 instead of 5 hack too and now works the ten point system with your addon (doesn't work in the default mode), but still doesn't appears the brown stars before rating. Also, in my style, appears now a second bar to show the default post rating. May be a problem with the latest addon..

http://img188.imageshack.us/img188/3918/tr3a.jpg

http://img518.imageshack.us/img518/8426/tr5i.jpg

Just trying :)

Faizan 08-21-2009 01:54 AM

i will try....

choccyclaire 08-21-2009 02:24 AM

Lovely thanks. Much better idea to have css as file too. Handier if people have many styles and want to mess with the colour of rating box quicker. :)

snowlion 08-21-2009 03:17 AM

I replaced all files, reimported product and after that: others member can't use ajax rate after a member voted, ajax rating don't clickable. :D Original thread rate still work fine.
You must refresh to see "You have already rated this article" message.

choccyclaire 08-21-2009 03:20 AM

^ I just noticed the above too.

mad@Max 08-21-2009 11:23 AM

For those who use ten point system - fixed bug with it (the little typo:)). I just doesn't test ten system.
snowlion, which version of vb you are using?

trotskid 08-21-2009 11:49 AM

Quote:

Originally Posted by mad@Max (Post 1871565)
For those who use ten point system - fixed bug with it (the little typo:)). I just doesn't test ten system.

Doesn't work and the brown stars still doesn't appear before rating.

snowlion 08-21-2009 12:11 PM

I'm using ver 3.8.2

mad@Max 08-21-2009 12:28 PM

Ok, i did following (as it needed for ten point):
Quote:

Open: threadrate.php

Find:

if ($vbulletin->GPC['vote'] < 1 OR $vbulletin->GPC['vote'] > 5)

Replace with:

if ($vbulletin->GPC['vote'] < 1 OR $vbulletin->GPC['vote'] > 10)

--------------------------------------------------------

Open: /includes/class_dm_threadrate.php

Find:

var $max_vote = 5;

Replace with:

var $max_vote = 10;
And i test the 10 point system on my forum (ex http://mixplay.ru/showthread.php?t=1520), so all working good:)

snowlion, you are edit this string?
PHP Code:

        $xml->add_tag('voteavg'process_replacement_vars("$vbphrase[rating]: <img class=\"inlineimg\" src=\"$stylevar[imgdir_rating]/rating_$thread[rating].gif\" alt=\"" construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\" border=\"0\" />")); 

And i test this hack on 3.8.2, same work good. If you has edited templates of hack - revert it.

trotskid 08-21-2009 01:00 PM

Thank you, now works the ten point system, but still doesn't appear the 10 brown stars before rating :(

http://img30.imageshack.us/img30/6369/tr7j.jpg

Another thing is that it's not possible to vote in the default mode with ten point system, and you always can emit a vote (to change it).

http://img193.imageshack.us/img193/1200/tr8y.jpg

mad@Max 08-21-2009 01:08 PM

trotskid, have are you edited templates before?

trotskid 08-21-2009 01:12 PM

Yeah, and the previous version (1.5.2) worked perfectly.

tldagent 08-21-2009 01:48 PM

How can we make this similar to the current rating as shown above in vb.org? Meaning select a rating rather than stars just as they would have done previously?

snowlion 08-21-2009 02:14 PM

Quote:

snowlion, you are edit this string?

And i test this hack on 3.8.2, same work good. If you has edited templates of hack - revert it.
Reverted but nothing change :D

Quote:

Yeah, and the previous version (1.5.2) worked perfectly.
i'm second this

Come2Daddy 08-21-2009 03:06 PM

what is 10 point system??
and how can we enable 10 points system??

PaylaX 08-21-2009 04:01 PM

bugs are very welcome:)

I'll wait.

Thanks for update

mad@Max 08-21-2009 04:27 PM

PM me who have a problem with hack, because i don't see a reason why it doesn't work.

mad@Max 08-21-2009 04:33 PM

Quote:

Originally Posted by Come2Daddy (Post 1871674)
what is 10 point system??
and how can we enable 10 points system??

Solution how did this https://vborg.vbsupport.ru/showthread.php?t=145110
I don't need this system, i simply executed the request:)
-----------
Added to first post: Difference between versions 1.x and 2.x: and TODO:

m2006 08-22-2009 03:43 AM

thank you verymuch for nice mod

Chief Corn 08-22-2009 12:16 PM

Does it plugin under $navbar? I have an article mod with its own showthread template, and it doesn't show up on there. It does work in my other forums though, but I installed it for use with the articles.

mad@Max 08-22-2009 02:11 PM

It's output from showthread script, i don't know how it output the article mod.

mad@Max 08-24-2009 11:13 PM

Version 2.5
In this version fixed all bugs (i hope:)).
And finally i made fully functionality with AJAX: rate, showing rating and deletion rating.

choccyclaire 08-24-2009 11:26 PM

Thank you!

Do we need to overwrite the files or just upload the product?

mad@Max 08-24-2009 11:34 PM

Overwrite all files (except img), and reimport product (better uninstall then install).

choccyclaire 08-24-2009 11:41 PM

Brilliant. Works like a charm. :)

And I also like the box popup to view stats alteration.

mad@Max 08-24-2009 11:47 PM

Archive is reuploaded (clean little mess after testing).
choccyclaire, i glad that you like:)

mad@Max 08-25-2009 01:26 AM

Version 2.5.1
Fixed couple bugs with js. Edited the product and vbulletin_ajax_oneclick_showrate.js.

mad@Max 08-27-2009 05:12 PM

Version 2.6
- navigation by page raters
- added video demo from youtube

wastemytime 08-27-2009 06:24 PM

Nice Hack, but if i want to rate a Thread, nothing happens. I reverted Template, checked the Files and Uploads...

mad@Max 08-27-2009 07:24 PM

Version of vB?

wastemytime 08-27-2009 10:11 PM

3.8.4

mad@Max 08-27-2009 11:55 PM

Hm, it tested on 3.8.2 and 3.8.4... Send me message to pm.


All times are GMT. The time now is 07:13 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01499 seconds
  • Memory Usage 1,835KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete