How to give specific reason when page is forbidden

We have many categories with different group permissions. Sometimes links are cross-posted so a user tries to access a category where he does not currently have permission. How can I show a specific reason, like “You are not a member of Group XYZ- click here to join.”?

I’ve already customized the text for page_forbidden.title, but only generically, like “You need to join a group, click here for a list of all the groups”. How can I make it specific? Could this be done with a plugin or theme component?

Maybe have a look at enabling admin-settings detailed 404? :thinking:

I wonder if there is a way to combine the customized forbidden page with CSS based on category?

1 Like