Exemplo n.º 1
0
function sendit_save_postdata($post_id)
{
    //print_r($_POST);
    if (!wp_verify_nonce($_POST['sendit_noncename'], 'sendit_noncename' . $post_id)) {
        return $post_id;
    }
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    if (!current_user_can('edit_page', $post_id)) {
        return $post_id;
    }
    $post = get_post($post_id);
    if ($post->post_type == 'newsletter') {
        update_post_meta($post_id, 'send_now', $_POST['send_now']);
        update_post_meta($post_id, 'sendit_list', $_POST['sendit_list']);
        //save scheduler data if exixts
        if (function_exists('Sendit_tracker_installation')) {
            update_post_meta($post_id, 'subscribers', get_list_subcribers($_POST['sendit_list']));
            update_post_meta($post_id, 'sendit_scheduled', $_POST['sendit_scheduled']);
        }
        return esc_attr($_POST);
    }
}
Exemplo n.º 2
0
function sendit_save_postdata($post_id)
{
    //print_r($_POST);
    //if ( !wp_verify_nonce( $_POST['sendit_noncename'], 'sendit_noncename'.$post_id ))
    //return $post_id;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    if (!current_user_can('edit_page', $post_id)) {
        return $post_id;
    }
    $post = get_post($post_id);
    if ($post->post_type == 'newsletter') {
        //old
        update_post_meta($post_id, 'send_now', $_POST['send_now']);
        update_post_meta($post_id, 'sendit_list', $_POST['sendit_list']);
        //old
        //new 3.0
        update_post_meta($post_id, 'newsletter_status', $_POST['newsletter_status']);
        if ($_POST['newsletter_status'] == 'send now') {
            send_newsletter($post_ID);
        }
        if ($_POST['send_now'] == '2') {
            wp_schedule_single_event(time() + 60, 'sendit_newsletter_scheduled');
        }
        //echo $_POST['newsletter_status'];
        update_post_meta($post_id, 'template_id', $_POST['template_id']);
        //save scheduler data if exixts
        if (function_exists('Sendit_tracker_installation')) {
            update_post_meta($post_id, 'subscribers', get_list_subcribers($_POST['sendit_list']));
            update_post_meta($post_id, 'sendit_scheduled', $_POST['sendit_scheduled']);
        }
        //save which template
        return esc_attr($_POST);
    }
}