Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
209 views
in Q2A Core by

I'm hacking a few parts of my Q2A installation on qa-theme-base.php , the thing is I'm changing the behavior of the ranking parts and now I'm having an error that shows only on the tags page that says  Undefined index: score  and it's pointing to the line 1363 on qa-theme-base.php which is this function:

public function ranking_score($item, $class) {
    $this->ranking_cell($item['score'], $class.'-score');
}

On the user's ranking page, the page is normal and it's not showing this error.. So my question now is, how can I write an if statement to run  $this->ranking_cell($item['score'], $class.'-score');  only on the top users (users ranking) page? I'm looking and trying to do is something like this:

public function ranking_score($item, $class) {
    if   isUserRankPage {
        $this->ranking_cell($item['score'], $class.'-score');
    }
}

 

1 Answer

+1 vote
by
selected by
 
Best answer

You could use the request member or the class variable itself. These 2 should be equivalent:

if ($this->request !== 'tags') { ... }

if ($class === 'qa-top-users') { ... }

by
Thanks a lot @pupi1985 it worked like a charm! :D
...