WordPress.org

Make WordPress Core

Changeset 9216


Ignore:
Timestamp:
10/16/08 21:59:06 (6 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r9103 r9216  
    1818require_once('includes/admin.php'); 
    1919 
    20 if ( !is_user_logged_in() ) 
     20if ( ! is_user_logged_in() ) { 
     21 
     22    if ( $_POST['action'] == 'autosave' ) { 
     23        $id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0; 
     24 
     25        if ( ! $id ) 
     26            die('-1'); 
     27 
     28        $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() ); 
     29            $x = new WP_Ajax_Response( array( 
     30                'what' => 'autosave', 
     31                'id' => $id, 
     32                'data' => $message 
     33            ) ); 
     34            $x->send(); 
     35    } 
     36 
    2137    die('-1'); 
     38} 
    2239 
    2340if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) { 
Note: See TracChangeset for help on using the changeset viewer.