Skip to content

Commit 6ba45b8

Browse files
committed
Issues-475: Fixed voting url for guest
1 parent 5dd27ec commit 6ba45b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Voting/class.voting.plugin.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ function formattedPScore($score)
346346
}
347347

348348
if (!function_exists('generateVoterBox')) {
349-
function generateVoterBox($id, $VoteType, $pScore, $nScore, $currentUserVote)
350-
{
349+
function generateVoterBox($id, $VoteType, $pScore, $nScore, $currentUserVote) {
350+
351351
$cssClassVoteUp = 'SpriteVoteUp';
352352
$cssClassVoteDown = 'SpriteVoteDown';
353353
if($currentUserVote > 0) {
@@ -359,6 +359,12 @@ function generateVoterBox($id, $VoteType, $pScore, $nScore, $currentUserVote)
359359
$voterBoxID = 'Voter_' . $VoteType . '_' . $id;
360360
$voteUpUrl = '/discussion/vote' . strtolower($VoteType) . '/' . $id . '/voteup/' . Gdn::session()->TransientKey() . '/';
361361
$voteDownUrl = '/discussion/vote' . strtolower($VoteType) . '/' . $id . '/votedown/' . Gdn::session()->TransientKey() . '/';
362+
363+
if (!Gdn::session()->IsValid()) {
364+
$voteUpUrl = Gdn::Authenticator()->SignInUrl(Gdn::controller()->SelfUrl);
365+
$voteDownUrl = Gdn::Authenticator()->SignInUrl(Gdn::controller()->SelfUrl);
366+
}
367+
362368
$result = '<span id="' . $voterBoxID . '" class="Voter">';
363369
$result .= Anchor(Wrap('', 'span', array('class' => 'icon ' . $cssClassVoteUp, 'rel' => 'nofollow')), $voteUpUrl, 'VoteUp');
364370
$counts = formattedPScore($pScore);

0 commit comments

Comments
 (0)