Plugin Directory

Changeset 1864546


Ignore:
Timestamp:
04/26/2018 05:21:02 AM (8 years ago)
Author:
nitinvp
Message:
  • Corrected cleaning up of post data after search result traversal. This fixes the issue of displaying Variables prev/next links in blog posts when a Variable is used and also disrupting other plugins like social sharing.
  • Corrected Variable specific updates messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c9-variables/trunk/includes/code/basic/admin/core/class-c9-variables-admin-delegate.php

    r1863910 r1864546  
    9595        // Uncomment the following only to support organizing variables using custom taxonomies (equivalent of tags)
    9696        /*register_taxonomy('c9_vars_variables', array(C9_Variables_Constants::$VARIABLES_POST_TYPE),
    97          [
    98          'labels'            => $labels,
    99          'hierarchical'      => false,
    100          'show_ui'           => true,
    101          'show_admin_column' => true,
    102          'rewrite'           => ['slug' => 'c9-variables']
    103          ]
     97             [
     98                 'labels'            => $labels,
     99                 'hierarchical'      => false,
     100                 'show_ui'           => true,
     101                 'show_admin_column' => true,
     102                 'rewrite'           => ['slug' => C9_Variables_Constants::$VARS_SLUG]
     103             ]
    104104         );*/
    105105    }
     
    148148    public function register_custom_filter_and_actions() {
    149149        add_action('save_post', [$this, 'save_variable_custom_fields'], 10, 2);
     150        add_action('post_updated_messages', [$this, 'variable_updated_messages'], 10, 1);
     151    }
     152   
     153    /** Provides updated messages for variables. */
     154    public function variable_updated_messages($messages) {
     155        $post = get_post();
     156        $post_type = get_post_type($post);
     157        $post_type_object = get_post_type_object($post_type);
     158       
     159        if ($post_type != C9_Variables_Constants::$VARIABLES_POST_TYPE) {
     160            return $messages;
     161        }
     162       
     163        $messages[$post_type] = [
     164            0  => '', // Unused, messages start at index 1
     165            1  => __('Variable updated.', 'c9-variables'),
     166            2  => __('Custom field updated.', 'c9-variables'),
     167            3  => __('Custom field deleted.', 'c9-variables'),
     168            4  => __('Variable updated.', 'c9-variables'),
     169            5  => isset($_GET['revision']) ? sprintf(__('Variable restored to revision from %s', 'c9-variables'), wp_post_revision_title( (int) $_GET['revision'], false)) : false,
     170            6  => __('Variable published.', 'c9-variables'),
     171            7  => __('Variable saved.', 'c9-variables'),
     172            8  => __('Variable submitted.', 'c9-variables'),
     173            9  => sprintf(__('Variable scheduled for: <strong>%1$s</strong>.', 'c9-variables'), date_i18n(__('M j, Y @ G:i', 'c9-variables'), strtotime($post->post_date))),
     174            10 => __('Variable draft updated.', 'c9-variables')
     175        ];
     176       
     177        return $messages;
    150178    }
    151179   
     
    183211            $end = $start + $curr_page_num_results - 1;
    184212            $is_next_page_available = ($end < $total) ? "true" : "false";
     213           
     214            // Clean up
     215            wp_reset_postdata();
    185216        }
    186217        $result = [
Note: See TracChangeset for help on using the changeset viewer.