Show warning if user is logged out while writing or editing, includes patch by tott, fixes #7630

git-svn-id: https://develop.svn.wordpress.org/trunk@9216 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2008-10-16 21:59:06 +00:00
parent bdfad5c6fc
commit 17cdcd2fdb
1 changed files with 19 additions and 2 deletions

View File

@ -17,8 +17,25 @@ define('WP_ADMIN', true);
require_once('../wp-load.php');
require_once('includes/admin.php');
if ( !is_user_logged_in() )
if ( ! is_user_logged_in() ) {
if ( $_POST['action'] == 'autosave' ) {
$id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0;
if ( ! $id )
die('-1');
$message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="blank">Please log in again.</a>'), wp_login_url() );
$x = new WP_Ajax_Response( array(
'what' => 'autosave',
'id' => $id,
'data' => $message
) );
$x->send();
}
die('-1');
}
if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
if ( !current_user_can( 'manage_categories' ) )
@ -955,4 +972,4 @@ default :
die('0');
break;
endswitch;
?>
?>