Make WordPress Core

Ticket #26758: 26758-edit-tag-form.php.patch

File 26758-edit-tag-form.php.patch, 2.1 KB (added by UmeshSingla, 11 years ago)

Added Message array and code to display message

  • edit-tag-form.php

     
    4848         */
    4949        do_action( 'edit_tag_form_pre', $tag );
    5050}
     51$messages = array();
     52$messages['_item'] = array(
     53        0 => '', // Unused. Messages start at index 1.
     54        1 => __( 'Item added.' ),
     55        2 => __( 'Item deleted.' ),
     56        3 => __( 'Item updated.' ),
     57        4 => __( 'Item not added.' ),
     58        5 => __( 'Item not updated.' ),
     59        6 => __( 'Items deleted.' )
     60);
     61$messages['category'] = array(
     62        0 => '', // Unused. Messages start at index 1.
     63        1 => __( 'Category added.' ),
     64        2 => __( 'Category deleted.' ),
     65        3 => __( 'Category updated.' ),
     66        4 => __( 'Category not added.' ),
     67        5 => __( 'Category not updated.' ),
     68        6 => __( 'Categories deleted.' )
     69);
     70$messages['post_tag'] = array(
     71        0 => '', // Unused. Messages start at index 1.
     72        1 => __( 'Tag added.' ),
     73        2 => __( 'Tag deleted.' ),
     74        3 => __( 'Tag updated.' ),
     75        4 => __( 'Tag not added.' ),
     76        5 => __( 'Tag not updated.' ),
     77        6 => __( 'Tags deleted.' )
     78);
     79
    5180/**
     81 * Filter the messages displayed when a tag is updated.
     82 *
     83 * @since 3.7.0
     84 *
     85 * @param array $messages The messages to be displayed.
     86 */
     87$messages = apply_filters( 'term_updated_messages', $messages );
     88
     89$message = false;
     90if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
     91        if ( isset( $messages[ $taxonomy ][ $msg ] ) )
     92                $message = $messages[ $taxonomy ][ $msg ];
     93        elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) )
     94                $message = $messages['_item'][ $msg ];
     95}
     96/**
    5297 * Fires before the Edit Term form for all taxonomies.
    5398 *
    5499 * The dynamic portion of the hook name, $taxonomy, refers to
     
    63108
    64109<div class="wrap">
    65110<h2><?php echo $tax->labels->edit_item; ?></h2>
     111<?php if ( $message ) : ?>
     112<div id="message" class="updated"><p><?php echo $message; ?></p></div>
     113<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
     114endif; ?>
    66115<div id="ajax-response"></div>
    67116<?php
    68117/**