Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved] how do i move it to DiscussionController_AuthorInfo_Handler ?

jeongweejeongwee ✭✭
edited August 2013 in Vanilla 2.0 - 2.8

i tryed to remove the lines

public function DiscussionController_AfterReactions_Handler($Sender, $Args) {

        Gdn::Controller()->FireEvent('BeforePeregrineReactions');
        $CountValues = array();

        $CountValues = $Sender->MyReactionCountData;
        $React[1] = T("");
        $TitleReact[1] = "Click me if the post is funny";
        $React[2] = T("");
        $TitleReact[2] = "Click me if the post made you say wow";
        $React[3] = T("");
        $TitleReact[3] = T("Click me if the post was informative");
        $React[4] = T("");
        $TitleReact[4] = T("Click me if the post was artistic or had great imagery");

        $RecordType = $Args['RecordType'];
        $RecordID = $Args['RecordID'];

        echo '';


        for ($x = 1; $x <= 4; $x++) {
            if (!isset($CountValues[$x]))
                $CountValues[$x] = 0;
            echo '<span class="ReactionCount';
            if ($CountValues[0] == $x) {
                echo " MyReactClick";
            }
            echo '">' . $CountValues[$x];

            echo '';

            $Image = Img("plugins/PeregrineReactions/design/images/ClickReaction-" . $x . ".png", array('alt' => 'reaction image', 'class' => "ProfilePhotoSmall"));

            echo '' . $Image . " " . $React[$x] . ' ';
        }
        echo ' ';
    }

and change the lines

 public function DiscussionController_AuthorInfo_Handler($Sender) {
    $AuthorInfo = $Sender->EventArguments['Author'];
    $totalreactionpoints = $AuthorInfo->PeregrineReactOne + $AuthorInfo->PeregrineReactTwo + $AuthorInfo->PeregrineReactThree + $AuthorInfo->PeregrineReactFour;
    echo sprintf(T('Total Reaction Points: %1s'), $totalreactionpoints);
    }

to

 public function DiscussionController_AuthorInfo_Handler($Sender, $Args) {

        Gdn::Controller()->FireEvent('BeforePeregrineReactions');
        $CountValues = array();

        $CountValues = $Sender->MyReactionCountData;
        $React[1] = T("");
        $TitleReact[1] = "Click me if the post is funny";
        $React[2] = T("");
        $TitleReact[2] = "Click me if the post made you say wow";
        $React[3] = T("");
        $TitleReact[3] = T("Click me if the post was informative");
        $React[4] = T("");
        $TitleReact[4] = T("Click me if the post was artistic or had great imagery");

        $RecordType = $Args['RecordType'];
        $RecordID = $Args['RecordID'];

        echo '';


        for ($x = 1; $x <= 4; $x++) {
            if (!isset($CountValues[$x]))
                $CountValues[$x] = 0;
            echo '<span class="ReactionCount';
            if ($CountValues[0] == $x) {
                echo " MyReactClick";
            }
            echo '">' . $CountValues[$x];

            echo '';

            $Image = Img("plugins/PeregrineReactions/design/images/ClickReaction-" . $x . ".png", array('alt' => 'reaction image', 'class' => "ProfilePhotoSmall"));

            echo '' . $Image . " " . $React[$x] . ' ';
        }
        echo ' ';
    }

after i done this , i refreshed my webpage.then Peregrine Reactions show at there.but it just moved not actualy working.when i clicking on it ,i got a alert "Too Few Args - Invalid."

image

my plugins\PeregrineReactions\default.php file is below here,just change the txt to php.can anyone tell me how do i fix it ,thx

Comments

Sign In or Register to comment.