-
-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Permission denied handling in WordPress by re-suing the get_p… #20206
Improve Permission denied handling in WordPress by re-suing the get_p… #20206
Conversation
…ermission_denied function to output message instead of Exception when permission is denied
(Standard links)
|
@seamuslee001 Looks good to me without a
I assume:
|
@seamuslee001 @christianwach @kcristiano do we think this is probably ok as is or needs a |
I can do an |
I actually think this change provides less flexibility to site developers and so I am not in favor of this being merged. In I run a WordPress site which does two things related to errors:
Our custom
We've taken the assumption that most exceptions go away when logged-in, although I appreciate this might not be sutiable for every site. In our Timber template we render the WordPress header and footer along with customised error text prompting the user to contact the site owner for help. With this pull request, I'm struggling to see how we would be able to customise the error page in this way. I actually wonder if the correct course of action is to keep the Exception here, which allows for developers to add logging and other custom handling, but to improve the It's also worth noting that I think |
@braders Funnily enough I was looking at this over the weekend too - but from a slightly different angle. I was trying - unsuccessfully as it happens - to wrap I can appreciate the sophistication of your approach but I would be surprised if it is one that the majority of CiviCRM-WordPress folks are able to implement and I so I remain supportive of the general gist of this PR, even if this implementation isn't quite right. I see no reason why your requirements for logging couldn't be satisfied with the addition to the method of e.g. $e = new \Exception();
CRM_Core_Error::debug_log_message(ts( 'Permission denied.'));
CRM_Core_Error::debug_log_message($e->getTraceAsString());
... etc etc ... What is, in my view, the incorrect approach is the current out-of-the-box behaviour. |
@christianwach Just to be clear, I absolutely am not opposed to CiviCRM handling this better out-of-the-box, I just want to ensure that possibilities for customising the error display still exist for those sites which need it. Something like the following would probable address my concerns (although a more concise name for the new filter could be found!). This ensures a message is still shown in the admin area, and allows sites to fallback to the current functionality (where they could do something similar to what I suggested above, e.g. for sites that need a custom error page, or for themes that are not using
I'm not sure I completely get what you mean about the exceptions. Are you suggesting that code gets added to |
@braders I agree that your approach is more flexible. And TBH I'm still not entirely sure that calling |
@seamuslee001 @BettyDolfing and I are reviewing PR's and we came across this one. It looks like it needs some additional work. Are you able to do this work? If not are you able to explain why it is not needed or we can close this PR. |
@seamuslee001 ^^ was 22 days ago - am closing until you want to revisit (if you do) |
…ermission_denied function to output message instead of Exception when permission is denied
Overview
This seeks to improve the handling when a user gets a Permission denied error in WordPress
Before
Yellow screen / fatal error caused by Exception being thrown
After
Page content replaced with a message saying you do not have permission
ping @kcristiano @mattwire @haystack thoughts?