Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

CSS and JS files aren't being included?

This discussion is related to the Thankful People 2 addon.
blizeHblizeH ✭✭
edited October 2014 in Vanilla 2.0 - 2.3

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.

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

    Very good catch, thanks again peregrine!

    peregrine
Sign In or Register to comment.