I want a separate 403 content for a page, depending on conditions. It is possible that a user is logged in and gets to a page which needs some role to access it. It would be nice feature if we can set separate 403 pages for separate url patterns or content types or a specific url.
I am using logintoboggan to show a user login form on 403. Now when the user logs in using the form then it still shows access denied as the page is accessible only to some other role. I want to guide the user or show some user friendly message to the user about how can he/she get that role (In my case it is a through paid membership). I can't add that on all 403 because its specific to a set of pages and should not be shown on other pages.
Would be better if we could extend this module to cover such generalized criteria's, so that admin's can configure through UI what should be the message shown on a particular condition to the user.
Comments
Comment #1
gisleThis feature request is similar to #1030434: Show different 403 pages per user role.. The latter provides a different error page for different user roles, while this wants a similar feature for different pages.
If somebody wants to provide a patch for this feature request, I would recommend that they try to do this by building on the customerroralt sub-module, instead of adding this directly to the main module. I want the main module to remain lean and simple.
Comment #2
dan3h commentedI like the idea of this feature.
Part of the problem that @sadashiv is having, though, is that LoginToboggan and CustomError don't seem to work well together. This is a related but separate issue, so I've made another ticket for it: #2382189: Play nicely with LoginToboggan when giving 403 errors
Comment #3
dan3h commented@sadashiv: I think you can do what you are trying to do using Login Toboggan's
theme_lt_access_denied()function (which gets called fromlogintoboggan_denied()). If you override that theme function, your override-function will get called whenever a user:If you put code in your function to look at what role they have, and display an appropriate message to them based on that, I think you may have solved your problem.
Comment #4
gisle@sadashiv,
did the adjustments to interoperation with LoginToboggan (re: #2382189: Play nicely with LoginToboggan when giving 403 errors) fix this for you, or do you still need this feature.
If you do not regard it as fixed, I need more details about your use case.
(I'll leave this open for two weeks for feedback.)
Comment #5
gisleNo response from OP is two weeks. Closing.
Feel free to reopen if you think that #2382189: Play nicely with LoginToboggan when giving 403 errors did not resolve your problem.
If you do not regard it as fixed, I need more details about your use case.