We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Undefined index notice fix | Forum

dave Leader
dave Nov 6 '16
Hi, i know this is just a notice so nothing critical but this notice has been appearing for some time now from the comment process and here is the fix for it.  I would upload this to the Github but i hate Github so ill just submit the fix here.  

The issue is that on the main page i get the notice about a undefied value for countOnPage...  and it was driving me nuts because i normally run my site with debug on while im developing. 

anyway i think this is the fix, it seems to work.. 


approx line 442

inside the foreach loop you will see this code 

          //old code          

          /* $entitiesForList[] = array('entityType' => $item['entityType'], 'entityId' => $item['entityId'], 'countOnPage' => $resultArray[$item['entityType']][$item['entityId']]['countOnPage']);         


this is the new code 

            //new code         

            $entitiesForList[] = array('entityType' => $item['entityType'], 'entityId' => $item['entityId'], 'countOnPage' => $resultArray[$item['entityType']][$item['entityId']]['commentsCount']);


basically i changed countOnPage to commentsCount in the last element of the array because there is no countOnPage in that array.

Hope that helps the devs make quick work of the fix.  


The Forum post is edited by dave Nov 6 '16