[BUG FIX] - Members_List Invalid page number SQL error

by coRpSE

Sun May 25, 2025 3:37 pm
Administrator
2396 Posts
Okay, working on someones site and checking error logs, I found they had a bunch of errors I have never seen before. After looking into it. I had written up a fix for this issue.

What was happening:

When someone went to the members list module and just say, tried visiting a page that didn't exist. It would throw an error. So what I did was wrote some code that counts the total number of valid users in the database, excluding anonymous users and those with a user level of -1. It then calculates how many pages are needed to display all users based on the number of items per page. By comparing the requested page number to the maximum possible pages, it prevents invalid page numbers that would cause SQL errors. This ensures the query always uses a safe and valid range for pagination.

To fix this, download the attached file and upload it to your site, keeping the file structure and overwrite your current file. To test to see it working, just go to your site, and put at the end of your URL this:

  /modules.php?name=Members_List&page=9999

If you don't see an error, you did it right.

Thankful People 2 user(s) is/are thankful for this post.
Mon May 26, 2025 3:00 pm
101 Posts
Great, work for me....
Tue May 27, 2025 11:46 am
Member
88 Posts
Nice!, Worked for me also.
Tue May 27, 2025 10:18 pm
GFX Artist
253 Posts
Updated and working fine at THE PORTAL  Razz

Thanks Corpse.

Wed May 28, 2025 12:41 am
Administrator
2396 Posts
n/p.