We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36592
    • 970 Posts
    Quote from: cmlawson at Jun 18, 2008, 06:55 PM

    Actually, when you click to vote it goes to an error page.
    I think you are using friendly url path and this snippet does not output proper url in that case...
    I changed this part
    	$starPhArray['starRating'] = "<ul class='star-rating'>
    		<li class='current-rating' style='width:" . $width . "px;'>" . $_lang['current_1'] . $currentStarValue . $_lang['current_2'] . "</li>
    		<li><a href='" . $modx->makeUrl($modx->documentObject['id'], $modx->documentObject['alias'], 'starvote=1&pid=' . $docID) . "' title='" . $_lang['one_star'] . "' class='one-star'>1</a></li>
    		<li><a href='" . $modx->makeUrl($modx->documentObject['id'], $modx->documentObject['alias'], 'starvote=2&pid=' . $docID) . "' title='" . $_lang['two_stars'] . "' class='two-stars'>2</a></li>
    		<li><a href='" . $modx->makeUrl($modx->documentObject['id'], $modx->documentObject['alias'], 'starvote=3&pid=' . $docID) . "' title='" . $_lang['three_stars'] . "' class='three-stars'>3</a></li>
    		<li><a href='" . $modx->makeUrl($modx->documentObject['id'], $modx->documentObject['alias'], 'starvote=4&pid=' . $docID) . "' title='" . $_lang['four_stars'] . "' class='four-stars'>4</a></li>
    		<li><a href='" . $modx->makeUrl($modx->documentObject['id'], $modx->documentObject['alias'], 'starvote=5&pid=' . $docID) . "' title='" . $_lang['five_stars'] . "' class='five-stars'>5</a></li>
    	</ul>";
    

    to
    	$starPhArray['starRating'] = "<ul class='star-rating'>
    		<li class='current-rating' style='width:" . $width . "px;'>" . $_lang['current_1'] . $currentStarValue . $_lang['current_2'] . "</li>
    		<li><a href='" . $modx->makeUrl($docID) . "?starvote=1&pid=" . $docID . "' title='" . $_lang['one_star'] . "' class='one-star'>1</a></li>
    		<li><a href='" . $modx->makeUrl($docID) . "?starvote=2&pid=" . $docID . "' title='" . $_lang['two_stars'] . "' class='two-stars'>2</a></li>
    		<li><a href='" . $modx->makeUrl($docID) . "?starvote=3&pid=" . $docID . "' title='" . $_lang['three_stars'] . "' class='three-stars'>3</a></li>
    		<li><a href='" . $modx->makeUrl($docID) . "?starvote=4&pid=" . $docID . "' title='" . $_lang['four_stars'] . "' class='four-stars'>4</a></li>
    		<li><a href='" . $modx->makeUrl($docID) . "?starvote=5&pid=" . $docID . "' title='" . $_lang['five_stars'] . "' class='five-stars'>5</a></li>
    	</ul>";
    
      • 5529
      • 70 Posts
      I am using friendly URLs, you’re right. I didn’t know that mattered?

      Now, when you say "I changed this part...to...", does that mean you want me to change that? Or, download it again because it’s fixed now? Or what?

      Thanks for looking into this further!! grin
        • 36592
        • 970 Posts
        Quote from: cmlawson at Jun 19, 2008, 03:43 PM

        I am using friendly URLs, you’re right.
        No. I thought you are using friendly url path.
        And this snippet seems to output bad url in this situation.
        So you need some modification of this snippet for it to work correctly.


        Now, when you say "I changed this part...to...", does that mean you want me to change that? Or, download it again because it’s fixed now? Or what?
        You have to change your snippet source in your MODx system.
        You can find those source code in your snippet source, and replace them like I posted in my previous post.

        Am I making myself clear ?
          • 5529
          • 70 Posts
          Yes, you are making yourself clear now. I greatly appreciate your time and effort on this! I will make the changes and post back here with the results.

          Again, thanks!
            • 5529
            • 70 Posts
            I made the changes, went to the front of the site and clicked a star and it read:

            You may only vote once.

            I haven’t really used the snippet before so I’m not sure if this is what it’s supposed to do? It seems when I’m looking through the repository, I see the star rating instead of messages.

            Am I overlooking something here?
              • 36592
              • 970 Posts
              Quote from: cmlawson at Jun 20, 2008, 12:42 AM

              You may only vote once.
              I am not an expert of PHP, but I looked into the source code of this snippet.

              This message is displayed when $novote (a variable in the snippet) is set to ’true’.
              And this $novote is set like this...
              $novote = ($useSession == true && isset ($_SESSION['starRating']['voted' . $docID])) ? true : false;
              

              I think you set &useSession=`1`(true) and the session is also set to true when you first voted(clicked the star).
              So I think this message is displayed properly in algorithm...

              I believe the stars can be seen when the session is cleared (use another browser or once kill the exsiting browser and restart).
                • 28033
                • 925 Posts
                What phpMyAdmin command can I run to "nuke" the votes in the database?

                I noticed that spambots went nuts clicking them, so I now am restricting votes to logged-in members only, but I want to get rid of the "false" votes.
                  My Snippets
                  -> PopUpChunk v1.0
                • All the votes are stored in the ’modx_site_tmplvar_contentvalues’ table but you’ll first need to find out the ID of the template variable that you created for the star rating. To find the ID of the TV, look in the ’modx_site_tmplvars’ table.

                  Then you could run a query against the database like (replace <TV ID> with the correct ID value):
                  DELETE FROM modx_site_tmplvar_contentvalues WHERE tmplvarid=<TV ID>;

                  That will remove all the values for the star ratings to date allowing you to start from afresh. Obviously, I would recommend taking a quick DB backup first ... yeah, i know, covering my own ass wink
                    Garry Nutting
                    Senior Developer
                    MODX, LLC

                    Email: [email protected]
                    Twitter: @garryn
                    Web: modx.com
                    • 24393
                    • 83 Posts
                    Quote from: BBloke at Apr 12, 2008, 12:10 PM

                    This may seem like an odd question or rather something that is just dumb but I’ve been looking at the ratings posted and there seems to be a lot of votes that are scoring 3. I haven’t been too bothered with it myself but a couple of people have commented on it.

                    Do any of you think that something could be a little off with the way the ratings work on my site?
                    http://il2mdb.montydan.com/


                    i am having the same problem. in fact ALL of the ratings have three stars!
                      stevesunderland.com
                      GRAPHICS | INTERACTIVE | MARKETING
                      xhtml + ajax + seo websites powered by modx
                      • 2912
                      • 315 Posts
                      Now that it’s been mentioned it would make sense. 1 searchbot would generate 5 votes totalling 15 points which would equate to the magic number 3. Mmmmmpph. Ek.. gonna have to see if I can stop this.
                        BBloke