1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Up Down Voting 1.0

Discussion in 'Plugins' started by Nick, Mar 2, 2010.

  1. robin007

    robin007 Well-Known Member

    Now showing this message
    Untitled.png
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    So it appears you do need to replace line 98 as described here. However, even when you do that, you can see your 'use_demote' value doesn't have a value. This is the problem. Are you sure when you save your settings, the checkbox for 'Send posts back to the "Latest" page if down voted back below the Top Posts threshold' remains checked? If it does (refresh the settings page just to confirm), go into the table hotaru_pluginsettings within the database and find the plugin_folder row for updown_voting. Within the plugin_value column, you should see something like this:
    Code:
    a:11:{s:11:"submit_vote";s:7:"checked";s:17:"submit_vote_value";s:1:"1";s:16:"votes_to_promote";s:1:"2";s:10:"use_demote";s:7:"checked";s:10:"use_alerts";s:7:"checked";s:14:"alerts_to_bury";s:1:"5";s:15:"physical_delete";s:0:"";s:17:"upcoming_duration";s:1:"5";s:13:"no_front_page";s:1:"5";s:12:"posts_widget";s:0:"";s:12:"widget_votes";s:7:"checked";}
    Do you see the part that says s:10:"use_demote";s:7:"checked";? Yours probably instead looks like s:10:"use_demote";s:0:"";. If use_demote doesn't indicate checked, it hasn't saved.

    So we have to figure out why your checkmark isn't saving when you save the settings. Try uninstalling and reinstalling the plugin and see if your settings will now save. If the checkbox still doesn't save, uninstall the plugin and then run the following SQL command on your database manually (e.g., from PHPMyAdmin):
    Code:
    DELETE FROM hotaru_pluginsettings WHERE plugin_folder = "updown_voting";
    Now reinstall the plugin and see if the checkbox will save.
     
  3. valMETNG

    valMETNG Administrator Staff Member Admin

    I just went into your test build (thanks for PMing me the credentials) and confirmed that your checkbox is saving. So please put back everything the way it was except for line 98 as described here. Then try your downvote again.
     
  4. robin007

    robin007 Well-Known Member

    now
    Untitled.png
     
  5. valMETNG

    valMETNG Administrator Staff Member Admin

    Ah... I think I figured out what's happening in my base build.

    You're using the same user to upvote and downvote. That use_demote setting only gets applied during the initial function updown_voting_vote_down. Upon subsequent upvotes and downvotes, it doesn't get applied (e.g., if you already voted up but are now voting down). To make it apply always, change lines 56 and 63 of\content\plugins\updown_voting\libs\UpdownVotingFunctions.php to:
    Code:
    $this->updown_voting_remove_vote($h, $post_id, $user_id, $voted, $vote_rating, $count_and_status, $updown_voting_settings);
    ...and change line 86 to:
    Code:
    function updown_voting_remove_vote($h, $post_id, $user_id, $voted, $vote_rating, $count_and_status, $updown_voting_settings)
    ...and add the following code to line 91:
    Code:
            if ($updown_voting_settings['use_demote'] && (($count_and_status->post_votes_up - 1) < $updown_voting_settings['votes_to_promote'])) {
                $sql = "UPDATE " . TABLE_POSTS . " SET post_status = %s WHERE post_id = %d";
                $h->db->query($h->db->prepare($sql, 'new', $post_id));
            }
    Edit: Don't forget to replace line 98 as described here.
     
  6. robin007

    robin007 Well-Known Member

    [​IMG]
    same message
     
  7. valMETNG

    valMETNG Administrator Staff Member Admin

    Sorry I wasn't clear - you can now put back everything as it was before we started (e.g., remove all the troubleshooting echo statements) except for line 98 of /content/plugins/updown_voting/updown_voting.php which should be:
    Code:
    $updown_voting_settings = $h->getSerializedSettings('updown_voting');
    Then follow the instructions in this post.
     
  8. robin007

    robin007 Well-Known Member

    Thank you very much now it is working:D
     
    valMETNG likes this.
  9. robin007

    robin007 Well-Known Member

    I have another problem also in this plugin.
    example :when i vote 5 posts at a time,
    3 post showing top of the popular page like
    1st post (1st voted post)
    2nd post (2nd voted post)
    3rd post (3rd voted post)
    old post
    old post
    .
    .
    .
    18th post (4th voted post)
    19th post (5th voted post)

    4th and 5th post showing next page of the popular page.
     
  10. valMETNG

    valMETNG Administrator Staff Member Admin

    According to lines 232-236 of \content\plugins\bookmarking\libs\BookmarkingFunctions.php, the sort order is by descending post_date. If you want to use a different column to sort (e.g., post_updatedts), you can change the field in line 236- e.g.:
    Code:
    $h->vars['orderby'] = "post_updatedts DESC";
     
  11. robin007

    robin007 Well-Known Member

    Cool thanks.
     

Share This Page