function frontier_post_reset_my_approval_cache($new_status, $old_status, $post)
{
    //error_log("Old status: ".$old_status." - New status: ".$new_status." - Post id: ".$post->ID);
    if ($new_status == "pending" || $old_status == "pending") {
        //error_log("delete cache");
        fp_delete_cache_names(FRONTIER_MY_APPROVALS_W_PREFIX);
    }
}
Esempio n. 2
0
function fp_delete_widget_cache()
{
    fp_delete_cache_names(FRONTIER_MY_POSTS_W_PREFIX);
    fp_delete_cache_names(FRONTIER_MY_APPROVALS_W_PREFIX);
}
 /** @see WP_Widget::update */
 function update($new_instance, $old_instance)
 {
     $tmp_boolean_fields = array('show_add_post', 'show_post_count', 'show_pending_posts', 'show_draft_posts');
     foreach ($this->defaults as $key => $value) {
         if (!isset($new_instance[$key])) {
             //check if is one of the logical fields (checkbox) and set value to false, so it isnt empty...
             if (in_array($key, $tmp_boolean_fields)) {
                 $new_instance[$key] = false;
             } else {
                 $new_instance[$key] = $value;
             }
         }
     }
     fp_delete_cache_names(FRONTIER_MY_POSTS_W_PREFIX . $this->number);
     return $new_instance;
 }
 /** @see WP_Widget::update */
 function update($new_instance, $old_instance)
 {
     $tmp_boolean_fields = array('show_draft', 'show_pending', 'show_comments', 'show_comment_spam', 'show_author');
     foreach ($this->defaults as $key => $value) {
         if (!isset($new_instance[$key])) {
             //check if is one of the logical fields (checkbox) and set value to false, so it isnt empty...
             if (in_array($key, $tmp_boolean_fields)) {
                 $new_instance[$key] = false;
             } else {
                 $new_instance[$key] = $value;
             }
         }
     }
     //error_log("New: ".print_r($new_instance, true)." - old: ".print_r($old_instance, true));
     // empty cache
     fp_delete_cache_names(FRONTIER_MY_APPROVALS_W_PREFIX . $this->number);
     return $new_instance;
 }