Plugin Directory

Changeset 696809


Ignore:
Timestamp:
04/12/2013 10:53:55 PM (13 years ago)
Author:
lightbulbdigital
Message:

show notification when post saved

Location:
lightbulb-save-and-close/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lightbulb-save-and-close/trunk/lightbulb-save-and-close.php

    r696790 r696809  
    55 * Plugin URI:  http://lightbulbdigital.com.au/wordpress-plugins
    66 * Description: Adds a button to the Edit Post page which saves the post and redirects back to the post listing page.
    7  * Version:     1.1
     7 * Version:     1.2
    88 * Author:      Lightbulb Digital
    99 * Author URI:  http://lightbulbdigital.com.au
     
    2222        add_action('post_submitbox_misc_actions', array('lb_save_close', 'add_button')); // add button
    2323        add_filter('redirect_post_location', array('lb_save_close', 'redirect'), '99'); // change redirect URL
     24        add_action('admin_notices', array('lb_save_close', 'saved_notice'));
    2425    }
    2526
     
    7374        // if we have an HTTP referer saved, and it's a post listing page, redirect back to that (maintains pagination, filters, etc.)
    7475        if (isset($_POST['saveclose_referer']) && strstr($_POST['saveclose_referer'], 'edit.php') !== false) {
     76            if (strstr($_POST['saveclose_referer'], 'lbsmessage') === false) {
     77                return $_POST['saveclose_referer'] . '&lbsmessage=1';
     78            }
    7579            return $_POST['saveclose_referer'];
    7680        }
    7781        // no referer saved, just redirect back to the main post listing page for the post type
    7882        else {
    79             return get_admin_url() . 'edit.php?message=1&post_type=' . $_POST['post_type'];
     83            return get_admin_url() . 'edit.php?lbsmessage=1&post_type=' . $_POST['post_type'];
     84        }
     85    }
     86
     87    /**
     88     * Display a notice on the post listing page to inform the user that a post was saved
     89     */
     90    public static function saved_notice() {
     91        if (isset($_GET['lbsmessage'])) {
     92            ?>
     93            <div class="updated">
     94                <p>Post saved</p>
     95            </div>
     96            <?php
    8097        }
    8198    }
  • lightbulb-save-and-close/trunk/readme.txt

    r696790 r696809  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4040* Allow post status to be changed to draft/pending when updating
    4141* Redirect back to previous post listing URL (to maintain filters and pagination)
     42
     43= 1.2 =
     44* Show notification when a post is saved
Note: See TracChangeset for help on using the changeset viewer.