I'm currently setting up a simple LMS in Drupal 8 and would like to customize the Access Denied page as follows:
- Anonymous users should be redirected to the Login page, when they hit a 403 error.
- Logged in users trying to access a specific content type (a Course), which they are not allowed to access, should be redirected to a custom message (telling them to buy the course or something like that). It would be even better, if they could be shown the teaser of that node, but that's not a necessity.
- In all other cases, I would like to show a general Access Denied page.
Fwiw, there were similiar questions for D6 here and here that also didn't receive any good replies.
Does anybody happen to know a good solution (for D8)? Any help would be much appreciated.
on403()
, see drupal.stackexchange.com/questions/165884/….