Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

My favorites - featured plugin error

0 votes

This error only shows up if user has no favorites. If user have at least one favorite, favorite shows.

Notice: Undefined index: qs in /qa-include/qa-app-format.php(1452) : eval()'d codeon line 42

Warning: Invalid argument supplied for foreach() in /qa-include/qa-app-format.php(1452) : eval()'d code on line 42

It probably doesn't check if $q_list['qs'] is an array but i don't know where exactly because i am using Q2A for only 1 day.

Thanks!

Q2A version: 1.5 beta 2
asked Jan 17 in Q2A Core by buco
edited Jan 18 by buco
I ask because the error is happening in a layer, and the only layer in the core Q2A core download is the Mouseover Layer, but that line number (42) doesn't match any reference to the 'qs' element. So please could you post the contents of your qa-plugin directory?
@gidgreen - you were right

it was the featured plugin - i use a lot of them but i figured it out :D

1 Answer

0 votes
 
Best answer

 

it was "featured" plugin 
 
There is no check for $q_list['qs']. You should change this code in the qa-featured-layer.php starting on line 41 from this:
function q_list($q_list) {
    foreach ($q_list['qs'] as $idx => $q_item)
      if($idx < $this->featured_questions)
        $q_list['qs'][$idx]['classes'] = @$q_list['qs'][$idx]['classes'].' qa-q-      list-item-featured';
      else
        break;
  qa_html_theme_base::q_list($q_list);
}
to this:
 
function q_list($q_list) {
  if(isset($q_list['qs'])){
    foreach ($q_list['qs'] as $idx => $q_item)
      if($idx < $this->featured_questions)
        $q_list['qs'][$idx]['classes'] = @$q_list['qs'][$idx]['classes'].' qa-q-list-item-featured';
      else
        break;
  }
  qa_html_theme_base::q_list($q_list);
}

 

answered Jan 18 by buco
edited Jan 18 by buco
FYI the final release of Q2A 1.5 (just out!) adds an empty 'qs' element on the favorites page, which should prevent this happening.