You are working in the backend, I assume? I’m also assuming you’ve made a management page of some sort? If so, look at the url on your management page. You’ll see a string like admin.php?page=something. That ‘something’ should match a value defined when you instantiated the management page. You need to pass that string around with whatever other parameters you are sending. So ?id=1234 would be admin.php?page=something&id=1234. You can make POST forms work by putting that string in a hidden form field like <input type="hidden" name="page" value="something" />.
Yeah working in the Backend. I’ve created a link where I’m creating the link: admin.php?page=something&id=1234 but when clicking on the link I get permission denied.
Ok. Then look at the function call that instantiates the page. The third or fourth parameter (Its different for top level and submenu pages) is the capability level that the user needs in order to access the page. Make sure your user has that capability. You might not want to use a values as generic as ‘id’ either. You can run into conflicts with internal stuff that way. Try something like ‘alexpluginid’ instead.
I’m an admin currently.
The parameter I’m passing is ‘faqid’ nothing generic. When I don’t pass the parameter it works fine but I obviously need the ID for this part to work.
How are you registering the backend page, can we see the line that registers the page please?
I’m not sure what’s wrong then. Maybe if you paste some code as t3los_ suggested.
add_submenu_page(__FILE__, 'Edit Question', 'Edit Question', 1, __FILE__.'/edit.php', 'bluefly_faq_admin_edit');
That registers the page, my guess is I’m missing something off the end?
Ok, well your links should be formed in the same format as the current page’s url..
So when viewing yourplugin/edit.php (as you’ve registered above), maybe something like..
example.com/wp-admin/admin.php?page=yourplugin/edit.php&var=var
Been a long time since i’ve used the add_submenu_page function, but i’m pretty sure it’s just how you’re forming your URLs …
ok, and how do I make it so the parameter on the end can be any number?
Let’s simplify a little, what is the url in your address bar when you’re viewing your plugin page, and what is the url you’re using with your links?
List:
admin.php?page=bluefly-faq/bluefly-faq.php/list.php
Then linked are created that look like:
admin.php?page=bluefly-faq/bluefly-faq.php/edit.php?faq=8
The problem is passing ?faq=8 results in a permission denied message.
Does the edit page work on it’s own?
admin.php?page=bluefly-faq/bluefly-faq.php/edit.php
Would you mind providing a copy of your plugin to test, i can’t really see why that would happen, i can however run the code and test it if you like…
[t31os edit]
*snip*
Replaced with pastebin version – http://wordpress.pastebin.ca/1816182
Keeps thread trim .. š