Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

SeoCompanion - If you use this plugin on vanilla 2.1

This discussion is related to the SEOCompanion addon.
peregrineperegrine MVP
edited May 2013 in Feedback

@Zhaan

carried over from related:

http://vanillaforums.org/discussion/23851/2-1b-bookmarking-and-editing-returns-error-discussioncontroller-discussion-not-found

for vanilla 2.1 try this, no guarantees but it may work for you, let us know.

change this in default.php

from

 public function Base_Render_Before(&$Sender)
  {

        //  CONFIGURATION - START

        $MetaDescriptionlimit = 20; // max. amount of words in the meta description. Should not be more than 50.
        $DefaultDescription= "Welcome to my Vanilla 2 Forum."; // Default Meta Description
        $DefaultTags = "forum vanilla"; // Default list of tags, blank space separated.

        // CONFIGURATION - END

        $Description = $Sender->Discussion->Body;
        if(strlen($Description)<1){
                $Description = $DefaultDescription;
        }
        $Description = explode(' ', strip_tags($Description));
        $Description = array_slice($Description,0,$MetaDescriptionlimit);
        $Description = implode(' ',$Description);
        $Sender->Head->AddTag('meta', array('name' => 'description', 'content'=>$Description));

        $Keywords = $Sender->Discussion->Tags;
        if (count($Keywords)<1){
            $Keywords = $DefaultTags;
        }
        $Keywords = explode(' ',$Keywords);
        $Keywords = implode(', ',$Keywords);
        $Sender->Head->AddTag('meta', array('name' => 'keywords', 'content'=>$Keywords));
  }

to

public function Base_Render_Before($Sender)
  {

        //  CONFIGURATION - START

        $MetaDescriptionlimit = 20; // max. amount of words in the meta description. Should not be more than 50.
        $DefaultDescription= "Welcome to my Vanilla 2 Forum."; // Default Meta Description
        $DefaultTags = "forum vanilla"; // Default list of tags, blank space separated.
        $Keywords = "";
        $Description = $DefaultDescription;
        // CONFIGURATION - END
        $Controller = $Sender->ControllerName;
        if ($Controller == "discussioncontroller") {
        $Description = $Sender->Discussion->Body;

        } 


        $Description = explode(' ', strip_tags($Description));
        $Description = array_slice($Description,0,$MetaDescriptionlimit);
        $Description = implode(' ',$Description);
        $Sender->Head->AddTag('meta', array('name' => 'description', 'content'=>$Description));

        if ($Controller == "discussioncontroller") {
           $Keywords = $Sender->Discussion->Tags;
            if (count($Keywords)<1){
            $Keywords = $DefaultTags;
            }
        $Keywords = explode(' ',$Keywords);
        $Keywords = implode(', ',$Keywords);
        $Sender->Head->AddTag('meta', array('name' => 'keywords', 'content'=>$Keywords));
        }
  }

the code could be cleaner - but the goal was to get rid of most of the errors, if not all in the shortest amount of time - 10 minutes :)

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

Tagged:
UnderDogvrijvlinder

Comments

  • @peregrine tried it but it didn't work for me. I still can't delete any discussion and my quote plugin is not working.

Sign In or Register to comment.