function set_view_template_callback() {
		if ( ! current_user_can( 'edit_posts' ) ) {
			die( "Untrusted user" );
		}
		if ( 
			! isset( $_POST["wpnonce"] )
			|| ! wp_verify_nonce( $_POST["wpnonce"], 'set_view_template' ) 
			|| ! isset( $_POST['view_template_id'] )
			|| ! isset( $_POST['type'] )
		) {
			die( "Undefined nonce" );
		}
        $view_template_id = $_POST['view_template_id'];
		$type = $_POST['type'];
		wpv_update_dissident_posts_from_template( $view_template_id, $type);
        die();
    }
Exemplo n.º 2
0
function wpv_apply_ct_to_cpt_posts_callback() {
	wpv_ajax_authenticate( 'work_view_template', array( 'parameter_source' => 'post', 'type_of_death' => 'data' ) );
   
    $id = intval( $_POST['id'] );
    $type = sanitize_text_field( $_POST['type'] );
    wpv_update_dissident_posts_from_template( $id, $type, false );
	
    wp_send_json_success();
}
function set_view_template_listing_callback()
{
    if (!isset($_POST["wpnonce"]) || !wp_verify_nonce($_POST["wpnonce"], 'work_view_template')) {
        die("Undefined Nonce.");
    }
    $view_template_id = $_POST['view_template_id'];
    $type = $_POST['type'];
    wpv_update_dissident_posts_from_template($view_template_id, $type);
    die;
}
 /**
  * Ajax function to set the current Content template to posts of a type
  * set in $_POST['type']
  *
  */
 function set_view_template_callback()
 {
     global $wpdb;
     if (empty($_POST) || !wp_verify_nonce('set_view_template', $_POST['wpnonce'])) {
         $view_template_id = $_POST['view_template_id'];
         $type = $_POST['type'];
         // list($join, $cond) = $this->_get_wpml_sql( $type, $_POST['lang'] );
         wpv_update_dissident_posts_from_template($view_template_id, $type);
     }
     die;
     // this is required to return a proper result
 }