Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a page in my admin with this custom query:

$rows = $wpdb->get_results("SELECT * FROM ej_feedback ORDER BY createdtime ASC");

I have made it successfully paginate as required in that the right amount of posts show on first page and the right amount of pagination links show up. Awesome!

However when I click on one of the pagination links to go onto page 2, I get an admin error:

You do not have sufficient permissions to access this page

The url looks like this:

/wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/

I really don't know why I'm getting this error in the admin. Is it a more general issue with the admin or is it related to using pagination in the admin area? Any help would be much appreciated.

The script works perfectly on the frontend - I just think Wordpress has a problem with the URL generated.

share|improve this question

1 Answer 1

The last part of the URL is being treated as part of the page value..

/wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/

The bold part is your plugin page, so when you go adding parts onto that URL it's considered to be part of that URL.

If you use this instead it should work no problem.

/wp-admin/admin.php?page=user-feedback/user-feedback.php&paged=2

Note: You can actually reproduce the problem quite easily adding anything else on in the same manner, eg.

/wp-admin/admin.php?page=user-feedback/user-feedback.php/foobar/

If you want pretty paged URLs for your plugin page you'll have to look into creating additional rewrites for those pages yourself, but that's perhaps for another question...(and not one i have time to answer - this particular issue was pretty easy to spot)

share|improve this answer
    
Thanks for your reply, I'll give this a try –  Adam Moss Dec 12 '11 at 11:26
    
You're welcome. :) –  t31os Dec 12 '11 at 11:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.