Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
star rating system
y2kbg
New
well i am trying to in corparate this unobtrusive star rater(http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/) with my vanilla forum, just a bunch on a page manager page.
I have it all working but
not as an extension
nor
does it track vanilla username to limit votes(it tracks ip numbers) I found the part of each script where it says $ip = and switch it to context+>/..whatever it is to get the username and and amble echo the username from in the function but when used to assign to ip it just messed up.
any one done this yet?
or a sugestion/help(i think it may have something todo with a part i saw that said serialize bt i dont know what that does but am doing more research now.)
0
This discussion has been closed.
Comments
this is not my website but the link to all the source:http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/)
<?php /* Page: rpc.php Created: Aug 2006 This page handles the 'AJAX' type response if the user has Javascript enabled. --------------------------------------------------------- ryan masuga, masugadesign.com ryan@masugadesign.com --------------------------------------------------------- */ header("Cache-Control: no-cache"); header("Pragma: nocache"); require('_config-rating.php'); // get the db connection info //getting the values $vote_sent = $_REQUEST['j']; $id_sent = $_REQUEST['q']; $ip_num = $_REQUEST['t']; $units = $_REQUEST['c']; //$ip = $_SERVER['REMOTE_ADDR']; $ip = $ip_num; //connecting to the database to get some information $query = mysql_query("SELECT total_votes, total_value, used_ips FROM $tableName WHERE id='$id_sent' ")or die(" Error: ".mysql_error()); $numbers = mysql_fetch_assoc($query); $checkIP = unserialize($numbers['used_ips']); echo $checkIP; $count = $numbers['total_votes']; //how many votes total $current_rating = $numbers['total_value']; //total number of rating added together and stored $sum = $vote_sent+$current_rating; // add together the current vote value and the total vote value $tense = ($count==1) ? "vote" : "votes"; //plural form votes/vote // checking to see if the first vote has been tallied // or increment the current number of votes ($sum==0 ? $added=0 : $added=$count+1); // if it is an array i.e. already has entries the push in another value ((is_array($checkIP)) ? array_push($checkIP,$ip_num) : $checkIP=array($ip_num)); $insertip=serialize($checkIP); if (($vote_sent >= 1 && $vote_sent <= $units) && ($ip == $ip_num)) { // keep votes within range, make sure IP matches - no monkey business! $update = "UPDATE $tableName SET total_votes='".$added."', total_value='".$sum."', used_ips='".$insertip."' WHERE id='$id_sent'"; $result = mysql_query($update); } // these are new queries to get the new values! $newtotals = mysql_query("SELECT total_votes, total_value, used_ips FROM $tableName WHERE id='$id_sent' ")or die(" Error: ".mysql_error()); $numbers = mysql_fetch_assoc($newtotals); $count = $numbers['total_votes'];//how many votes total $current_rating = $numbers['total_value'];//total number of rating added together and stored $tense = ($count==1) ? "vote" : "votes"; //plural form votes/vote $new_back = "<ul class="unit-rating" style="width:". $units*$unitwidth ."px;">n". "<li class="current-rating" style="width:". @number_format($current_rating/$count,2)*$unitwidth ."px;">Current rating.</li>n". "<li class="r1-unit">1</li>n". "<li class="r2-unit">2</li>n". "<li class="r3-unit">3</li>n". "<li class="r4-unit">4</li>n". "<li class="r5-unit">5</li>n". "<li class="r6-unit">6</li>n". "<li class="r7-unit">7</li>n". "<li class="r8-unit">8</li>n". "<li class="r9-unit">9</li>n". "<li class="r10-unit">10</li>n". "</ul>". "<p class="voted">$id_sent. Rating: <strong>".@number_format($sum/$added,1)."</strong>/".$units." (".$count." ".$tense." cast) ". "<span class="thanks">Thanks for voting!</span></p>";//show the updated value of the vote //name of the div id to be updated | the html that needs to be changed $output = "unit_long$id_sent|$new_back"; echo $output; ?>
you can see where i changed $ip to the username, there are two files tho, one for ajax(this one) and another one that will degrade to a refreshing page if javascript is turned off. The i modifyed the degraded version and got it working so it is just the ajax version that needs to be fixed. i guess there could be another file where it is messed up(one of two .js files whitch can be found in the source.
i have working on this problem for weeks now.
Vincent-->well what is your problem right now getting the references correct? if so i never got them to work so i just installed the files into the same directory as vanillia but i really want to make it an extension.
but thats not the problem the prob is that it tryed to render the stars before i set up the database
listing a bunch of WP star rating systems/methods including the one you mentioned...
They list one that looks really good/simple and uses prototype lite (so should work with the default prototype too, not?):
http://www.duarte.com/starry/
Not sure what your goals are, but this 'hosted service' looks easy too http://star.recompile.net/
Note: FWIW, I tried inserting it here, but this cause a weird error in the preview.
Fatal error: Call to undefined function: getunreadquerystring() in /applications/lussumo/community/extensions/PanelLists/default.php on line 72