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.
Why does this line causes errors on discussion management?
fr3em1nd
✭✭
hi guys snipped this out from SEOcompanion plugin, i have enabled tagging and would like to use this as class theme hooks but it causes random errors on discussion management in vanilla 2.1 i'm not sure what i have missed.
public function Base_Render_Before($Sender){ $Description = $Sender->Discussion->Body; if(strlen($Description)<1){ $Description = "My site description"; } $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 = "my site keywords"; } $Keywords = explode(' ',$Keywords); $Keywords = implode(', ',str_replace('-',' ',$Keywords)); $Sender->Head->AddTag('meta', array('name' => 'keywords', 'content'=>$Keywords)); }
0
Answers
I think if you are going to put that in the theme you must replace $Sender with $this
just a hunch coz I was messing with stuff like that and kept getting error then I saw I left a $Sender when it should have been $this.... but it is just a hunch and likely wrong, just suspect it has something to do with it
$this->Head->AddTag
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
hi @vrijvlinder i'm not sure also but this line
public function Base_Render_Before($Sender){
tells that the variable $Sender is the one that should be used in the function right ?