Opened 16 years ago
Closed 11 years ago
#8420 closed enhancement (duplicate)
Disable error redirects when in DOING_AJAX
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | 2.7 |
Component: | Administration | Keywords: | has-patch 3.2-early gci |
Focuses: | Cc: |
Description
If a DB/install error occurs in admin during ajax requests (like autosave), the response shouldn't return the whole redirected page, see $ATT (admin-ajax-install-trigger.png). If something goes awry and we're DOING_AJAX, an error message that could fit inline would be better.
Attachments (8)
Change History (21)
#4
@
14 years ago
- Keywords has-patch 2nd-opinion added; ajax error redirect removed
Needs to have a nice message than the current dumb one.
Does anything in the code need to be changed?
#5
@
14 years ago
This is a good first pass at fixing this issue but I think it is worth seeing if we can resolve this generically for all calls to wp_die duing AJAX requests.
At the moment your message is very specific to the autosave scenario and will not make much sense in other scenarios.
Please could you look at implementing a different wp_die handler for AJAX requests - hint look at wp_die
and _default_wp_die_handler
to make a generic solution and also look at changing the AJAX code so that it recognises these error messages as responses
#7
@
14 years ago
This looks like it is starting to come together well.
It would be good to get a patch up here of all your changes as at the moment you are only generating patches for individual files which makes it much harder to review.
We have some tips on generating patches linked from the front page which might help.
#8
@
14 years ago
This latest patch is look great.
The next step on this will probably be not to return with 'what' => 'autosave',
but with 'what' => 'error',
.
This will mean that the autosave js would need changing to handle this different response correctly probably.
You can add: define( 'SCRIPT_DEBUG', true);
to your wp-config.php and then just edit and patch the .dev.js files to test this out.
#9
@
14 years ago
I changed the function to use the core wordpress error handling system. And it works good now. But, it isn't shown in the form of error when the error is loaded in the UI. It is left-aligned, and doesn't has the red theme.
I found that this happens because of the issue I have posted here - http://stackoverflow.com/questions/4279657/somethings-wrong-with-this-jquery-code-in-wordpress
The wp_error tag is not being recognized by jQuery('wp_error', child) ....
Anybody?
#10
@
14 years ago
The current patch doesn't apply to trunk very well - I get some rejects.
Even then it doesn't seem to actually send anything back in an error scenario from my testing.
Maybe something like the logged-out inline alert could do.