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.

CSS and JS files aren't being included?

blizeHblizeH ✭✭
edited October 2014 in Vanilla 2.0 - 2.8

Hi,

I've just installed and enabled the Thankful 2 plugin and it works great, except the following two files aren't being added:

  • plugins/ThankfulPeople/design/thankfulpeople.css
  • plugins/ThankfulPeople/js/thankfulpeople.functions.js

I've checked in the code and they are definitely included in the DiscussionController_Render_Before function:

        public function DiscussionController_Render_Before($Sender) {
                if (!($Sender->DeliveryType() == DELIVERY_TYPE_ALL && $Sender->SyndicationMethod == SYNDICATION_NONE)) return;
                $ThanksLogModel = new ThanksLogModel();
                $DiscussionID = $Sender->DiscussionID;
                // TODO: Permission view thanked
                $CommentIDs = ConsolidateArrayValuesByKey($Sender->CommentData->Result(), 'CommentID');
                $DiscussionCommentThankDataSet = $ThanksLogModel->GetDiscussionComments($DiscussionID, $CommentIDs);

                // TODO: FireEvent here to allow collect thanks from other objects

                // Consolidate.
                foreach ($DiscussionCommentThankDataSet as $ThankData) {
                        $CommentID = $ThankData->CommentID;
                        if ($CommentID > 0) {
                                $this->CommentGroup[$CommentID][] = $ThankData;
                                $this->ThankForComment[$CommentID][] = $ThankData->UserID;
                        } elseif ($ThankData->DiscussionID > 0) {
                                $this->DiscussionData[$ThankData->UserID] = $ThankData;
                        }
                }

                $Sender->AddJsFile('jquery.expander.js');
                $Sender->AddCssFile('plugins/ThankfulPeople/design/thankfulpeople.css');
                $Sender->AddJsFile('plugins/ThankfulPeople/js/thankfulpeople.functions.js');

                $Sender->AddDefinition('ExpandThankList', T(' Show More'));
                $Sender->AddDefinition('CollapseThankList', T(' Hide'));
        }

The styling isn't being applied as a result, so the 'Thanked by' blends in with the post itself, also since the .js file isn't included if you thank someone it refreshes the entire page.

Any idea what I've done wrong please? :smile: Thank you!

Comments

  • peregrineperegrine MVP
    edited October 2014

    bug in the plugin.

      $Sender->AddCssFile('plugins/ThankfulPeople/design/thankfulpeople.css');
                $Sender->AddJsFile('plugins/ThankfulPeople/js/thankfulpeople.functions.js');
    

    should be:

    $Sender->AddCssFile('plugins/ThankfulPeople2/design/thankfulpeople.css');
                    $Sender->AddJsFile('plugins/ThankfulPeople2/js/thankfulpeople.functions.js');
    

    should fix it.

    but

    entire plugin should be gone over and - also the class should be changed and every reference to ThankfulPeople changed to ThankfulPeople2
    as well as file names everywhere.

    an incomplete upgrade that appears not to be maintained by the second author.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Argh! How did I not spot that... :)

    Very good catch, thanks again peregrine!

Sign In or Register to comment.