HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Quick change to popular posts list items MostPopular plugin

This discussion is related to the MostPopular addon.

Noticed a small bug. In class.mostpopularmodule.php, if the loop that adds new list items (ie popular posts) runs out of items and returns, then the html outputted will create a list that envelopes whatever module or html is below it on the page. I added a small fix around lines 40-43 (I changed other things in the script so I'm not sure where this is in the original)...look for the line:

if($DiscID < 1) return;

And I changed this to:

if($DiscID < 1) { echo "</ul></div>"; return; }

Looks like this effectively closes that loop with the end ul and div tags in the event of the loop running out of new list items to append.

I made a few other changes to the script (added the original user's photo, and added the ability to not include private category posts), but I won't post the changes unless peregrine wants them. Hope this helps someone.


Sign In or Register to comment.