Post with content longer than 1000 characters

Hi,

I found another bug.

When trying publish to FB post with content longer than 1000 characters nothing happens on FB but plugin sets wdfb_published_on_fb to 1 :slight_frown:

I make little investigation and I found that FB api returns:

(#100) caption parameter cannot be longer than 1000 characters.

I think that little code change can be helpfull to found some issues.

Here my changes:

file class_wdfb_model.php

try {
$ret = $this->fb->api('/' . $fid . '/' . $type . '/', 'POST', $post);
} catch (Exception $e) {
return false;
}

change to:

$ret = $this->fb->api('/' . $fid . '/' . $type . '/', 'POST', $post);

file class_wdfb_admin_pages.php

$res = $this->model->post_on_facebook($post_as, $post_to, $send);
update_post_meta($post_id, 'wdfb_published_on_fb', 1);

change to:

try {
$res = $this->model->post_on_facebook($post_as, $post_to, $send);
update_post_meta($post_id, 'wdfb_published_on_fb', 1);
delete_post_meta($post_id, 'wdfb_exception');
} catch (Exception $e) {
update_post_meta($post_id, 'wdfb_exception', $e->getMessage());
delete_post_meta($post_id, 'wdfb_published_on_fb');
}

And now if there was some error with publishing to FB there will be error message in meta wdfb_exception.

To publish longer posts I changed

$send = array(
'caption' => $post->post_content,

to

$send = array(
'caption' => substr($post->post_content,0,999),

but I know that there is more elegant way to do it :slight_smile:

grola

(sorry for my English, but I hope you understand what I wrote) :wink: