We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5948
    • 32 Posts
    @pixillionsaul

    try putting

    GLOBAL $modx;


    at the top of the file or in any functions that you need to use $modx

    Quote from: pixillionsaul at Mar 05, 2009, 05:50 AM

    Still having issues with web users, it appears that the anythingRating.class.inc.php file can’t use any of the modx api functions, I don’t know enough about the modx core to know why, or if there is anyway I can turn it on, anyone know more?
      • 9714
      • 38 Posts
      Hello,

      Just started using AnythingRating for my site great Add-on by the way and found something I would like to fix but don’t know how.

      Before you vote the rating system is not xhtml Transitional valid:
      <ul id="rater_39" class="star-rating">
      <li class="current-rating" style="width:0%;"></li>
      <li><a onclick="rate('20','Articles','39');return false;" href="/tns/39?q=tns/39&atrGrp=Articles&atrId=39&rating=20" title="1 star out of 5" class="stars1" >1</a></li>
      <li><a onclick="rate('40','Articles','39');return false;" href="/tns/39?q=tns/39&atrGrp=Articles&atrId=39&rating=40" title="2 stars out of 5" class="stars2" >2</a></li>
      <li><a onclick="rate('60','Articles','39');return false;" href="/tns/39?q=tns/39&atrGrp=Articles&atrId=39&rating=60" title="3 stars out of 5" class="stars3" >3</a></li>
      <li><a onclick="rate('80','Articles','39');return false;" href="/tns/39?q=tns/39&atrGrp=Articles&atrId=39&rating=80" title="4 stars out of 5" class="stars4" >4</a></li>
      <li><a onclick="rate('100','Articles','39');return false;" href="/tns/39?q=tns/39&atrGrp=Articles&atrId=39&rating=100" title="5 stars out of 5" class="stars5" >5</a></li>
      </ul>
      


      But once you vote it is xhtml Transitional valid:
      <ul id="rater_39" class="star-rating2">
      <li class="current-rating" style="width:100%;"></li>
      <li><a onclick="return false;" href="/tns/39" title="1 star out of 5" class="stars1" >1</a></li>
      <li><a onclick="return false;" href="/tns/39" title="2 stars out of 5" class="stars2" >2</a></li>
      <li><a onclick="return false;" href="/tns/39" title="3 stars out of 5" class="stars3" >3</a></li>
      <li><a onclick="return false;" href="/tns/39" title="4 stars out of 5" class="stars4" >4</a></li>
      <li><a onclick="return false;" href="/tns/39" title="5 stars out of 5" class="stars5" >5</a></li>
      </ul>
      
      


      As you can see it uses the "&" symbol when it should use the "&amp;" instead so it’s valid.

      Now am no Modx Add-on specialist, actually I am just starting to learn some Modx Code if you will allow that term and I don’t know how to change the "&" to "&amp;"

      Any help would be nice since it’s the only non xhtml valid thing on my site and I try to keep my sites xhtml.

      -FireDart
        -FireDart
        • 30311
        • 3 Posts
        Hi, have somebody experience with AnythingRating snippet and Use friendly alias path:Yes?
        After voting I get a 404 ERROR page into <div class="score"> block.

        html of LI star is:
        <li>
        <a class="stars5" title="5 of 5" href="/level_1/level_1_1/level_1_1_1/level_1_1_1_1?q=level_1/level_1_1/level_1_1_1/level_1_1_1_1&atrGrp=portfolio&atrId=73&rating=100" onclick="rate('100','portfolio','73');return false;">5</a>
        </li>


        Without Ajax - anythingRating.js is posible to voting, but with Ajax have always this problem. sad

        By the way thx coroico for this snippet.

        t.
          • 5915
          • 21 Posts
          Is there going to an update to this outdated star rating system?
            • 9714
            • 38 Posts
            Quote from: CrashOverride at Jun 06, 2009, 07:26 PM

            Is there going to an update to this outdated star rating system?

            I hope they make an update, it’s such a good add-on. If they do I hope they make it xhtml valid.

            -FireDart
              -FireDart
              • 21524
              • 90 Posts
              hi, is there a way to allow one vote by cookies only? i’m making an intranet project for a company, many of the computers share the same ip. and unfortunately it can’t be changed.

              can you help me with this problem?
                • 21524
                • 90 Posts
                no one can help?
                  • 5811
                  • 1,717 Posts
                  hi, is there a way to allow one vote by cookies only? i’m making an intranet project for a company, many of the computers share the same ip. and unfortunately it can’t be changed.

                  By default one vote only is allowed (&multiVote=`0`). The test is the following (see anythingRating.class.inc.php line 443):
                      if ($rating <= 100 && $rating >= 0){
                          $where = "lastIP = '".$_SERVER['REMOTE_ADDR']."' AND rating_id = '$id'";
                          $SELECT_RATING = "SELECT id FROM $this->tbRating WHERE $where;";
                  
                          if ( (!$multiVote) && ($modx->db->getRow($modx->db->query($SELECT_RATING)) || isset($_COOKIE[$grp.'_'.$id]))){
                              if ($js) die("ERROR:".$this->lang['atr_already_voted']);
                              else echo "<p class='already-voted'>".$this->lang['atr_already_voted']."</p>";
                          } 

                  if ( (!$multiVote) && ($modx->db->getRow($modx->db->query($SELECT_RATING)) || isset($_COOKIE[$grp.’_’.$id]))){
                  means you got a message "you have already voted" if you have already set a cookie what ever your ip address.
                  So, I think that you could use several PC with the same IP without any hacking of the code.
                    • 21524
                    • 90 Posts
                    the problem is that this doesn’t work. after one voted no one is able to vote. everyone gets "You already voted" message. It could be not IP issue, but still it’s a problem. huh
                      • 5811
                      • 1,717 Posts
                      As soon as one person has voted, a record with the ip address is stored in the table. So If an another person try to vote as first time,
                      if ( (!$multiVote) && ($modx->db->getRow($modx->db->query($SELECT_RATING)) || isset($_COOKIE[$grp.'_'.$id]))){ 
                      is true and the person get the message "already voted".

                      To avoid that, replace
                       if ( (!$multiVote) && ($modx->db->getRow($modx->db->query($SELECT_RATING)) || isset($_COOKIE[$grp.'_'.$id]))){
                      by
                       if ( (!$multiVote) && (isset($_COOKIE[$grp.'_'.$id]))){

                      So now, a second person could vote and if a second vote is requested by the same person, due to the cookie, the above statement becomes true and the person get the message "already voted".
                      Try it and let me know if it is ok