I’ve stumbled upon another problem. My project has a system for user account management and one action available to a user and an admin is ‘delete’. Now I can’t get past the isPostRequest check inside the action. It’s in the controller generated by Gii. When I call the ‘delete’ action from the user menu (e.g. UserController/DeleteAction), it isn’t recognised as a POST request.
Another thing that puzzles me is the URL in the admin view (which uses CGridView to view all users in the system, and View/Update/Delete buttons). The URL finishes with ‘/delete&id=1’. I noticed that in the Blog demo, the similar URL finishes with ‘delete?id=1’ (and the POST check condition returns true there)… Can the URL have any influence?
Yeah, that’s another thing that you can see the id in the URL. But my main problem is why doesn’t a URL in the ‘?key=value’ style pass the isPostRequest check… What are the prerequisites so that Yii identifies a URL as a POST request?
A sample code I’m using in my actionDelete method in the User controller: