miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Easy Post Rating System

 
 
Page  Page 1 of 2:  1  2  Next »

Author Bluesplayer
Partaker
#1 | Posted: 12 Jan 2013 15:22 
I found a FREE script that is pretty easy to setup for forum post rating:

Rating Script

On the last discussions page and topics pages I used the topic title to create the needed div setting for the display to show. I also used a different ratings.js file with part of the code removed so that it doesn't function properly, only part of. That way only the star displays shows. I also created new smaller icons.

Last Discussions

On the post page I used different css settings so that bigger icons display and a fully functioning js file. Only here can visitors rate the post.

A post

The js files need to be placed above the div so that it doesn't upset other javascripts you might have in the page.

Seems to work fine and was quite easy to do.

Author kuopassa
Partaker
#2 | Posted: 12 Jan 2013 23:50 
I like that. It could perhaps be used to show microformats data based on that rating value etc.

Author Bluesplayer
Partaker
#3 | Posted: 13 Jan 2013 00:27 
kuopassa:
I like that. It could perhaps be used to show microformats data based on that rating value etc.
A great aspect of the script is that you can choose to either save the data in a text file or a database. Choosing the database allows you to use the rating results combined with other code that uses the database. I have done this within my site such as here:

Washing Machines
(see under 'Forum Offers')

As you say the data can be used for loads of different purposes.

Author kuopassa
Partaker
#4 | Posted: 13 Jan 2013 20:40 
Do you happen to know if there's in miniBB some easy way to fetch current topic's ID from database?

Author Bluesplayer
Partaker
#5 | Posted: 13 Jan 2013 20:53 
Don't know about an easy way but I had to alter various files and create my own variables, in fact I made my own files to access the database tables in a few instances.

If you want to get the current topic id when viewing topics for instance then you will need to alter bb_func_vtopic.php and then use your created variable in the main_topics.html or main_topics_cell.html file.

At least the above is what I did but I am no minibb expert.

Author kuopassa
Partaker
#6 | Posted: 13 Jan 2013 21:27 
Thanks for your help. :-) You pointed me to the right direction: inside bb_func_vtopic.php there's a tag 6000 that is apparently the plain numerical value of the current topic. So now I've constructed the ratings tag to be this:

<div class="srtgs" id="rt_6000"></div>

Author Bluesplayer
Partaker
#7 | Posted: 13 Jan 2013 21:33 
kuopassa:
Thanks for your help. :-) You pointed me to the right direction: inside bb_func_vtopic.php there's a tag 6000 that is apparently the plain numerical value of the current topic. So now I've constructed the ratings tag to be this:

<div class="srtgs" id="rt_6000"></div>
I just used the topic title variable like this:

<div class="srtgs" id="rt_{$topicTitle}"></div>

I might well use yours if it works on my setup as it is a lot shorter and less prone to errors.

Author kuopassa
Partaker
#8 | Posted: 13 Jan 2013 21:41 
I think my solution needs a little addition to make absolutely sure two different topics won't get identical value:

<div class="srtgs" id="rt_f12t6000"></div>

Author Bluesplayer
Partaker
#9 | Posted: 13 Jan 2013 21:47 
Yeah, you have raised a good point and one I hadn't thought of - duplicate title posts. I will have to add the topic id as well. By the way the TopicTitle only works on the topic page. On the post page I used:

<div class="srtgs" id="rt_Easy Post Rating System"></div>

Author kuopassa
Partaker
#10 | Posted: 14 Jan 2013 00:41 
Alright, now I've managed to fiddle some code that should create a so called "Rich Snippet" that Google could show on search results. You can see what I mean by opening this link that has as an example my miniBB forum. The stars on the search result can be a powerful way to get more traffic.

The code that goes to bb_plugins.php is:

$rating_id = 'rt_f'.$forum.'t'.$topic;
$points = "SELECT `nrrates`, REPLACE(ROUND(AVG(totalrate),0),'.',',') FROM `ratings_plugin_items` WHERE `item` = '$rating_id'";
$topic_title = mysql_query("SELECT `topic_title` FROM `minibb_topics` WHERE `topic_id` = '$topic'");
$topic_title = mysql_result($topic_title,0,0);
$results = mysql_query($points);
$result = mysql_result($results, 0, 1);
$votes = mysql_result($results, 0, 0);
if (($result) or ($result === '0')) {
if ((isset($topic_title)) && (!empty($topic_title))) {
$topic_title = ucfirst($topic_title);
}
else {
$topic_title = '#'.$topic;
}
$result = $result/$votes;
$rating_rich_snippet = '<p id="ratings" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">&quot;<span itemprop="itemreviewed">'.$topic_title.'</span>&quot; has been given <span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span itemprop="average">'.$result.'</span>/<span itemprop="best">10</span></span>. It´s based on <span itemprop="votes">'.$votes.'</span> votes.</p>';
}

The parts that have been bolded are the ones you should change to your forum's settings. After this code is placed inside bb_plugins.php you can activate the rich snippet HTML by pasting tag {$rating_rich_snippet} inside main_posts.html.

(Sorry Paul, I have no idea how the db_simpleSelect etc. functions are used. :-)

Author Bluesplayer
Partaker
#11 | Posted: 14 Jan 2013 00:48 
Excellent work.

I will use the above after I have updated my category forum rating display pages - quite a few to alter. Altered all the code now to stop any duplicated titles causing problems by using both forum and topic id's as you mentioned above.

Author Bluesplayer
Partaker
#12 | Posted: 14 Jan 2013 01:43 
If you are interested I can make another post to explain how I added Facebook / Twitter buttons to the Latest Discussions and Forum Topic Titles. Post pages can use the standard buttons as these will automatically use the post title and url. Again quite easy to do and uses the Topic Titles, though the Twitter button title has to be stripped of various chars to stop the submission failing.

Author kuopassa
Partaker
#13 | Posted: 14 Jan 2013 02:46 
Sure, I'm always intestered of new ways to enhance the user experience. You built earlier some sitemap script, and that is also one thing I really should insert to my site. :-)

Author Bluesplayer
Partaker
#14 | Posted: 14 Jan 2013 03:13 
The sitemap script does seem to work ok but needs refining quite a bit. I haven't looked at it for a while.

I will post some info regarding the Facebook / Twitter adaptation tomorrow.

Author Jaime
Partaker
#15 | Posted: 14 Jan 2013 10:40 
Thanks for your interesting posts, because I have to do something soon. :)

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Easy Post Rating System
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑