forked from friendica/friendica-addons
fbpost: queueing of facebook comments didn't worked at every time.
This commit is contained in:
parent
5eb18422c4
commit
4436168b26
1 changed files with 17 additions and 4 deletions
|
@ -293,8 +293,8 @@ function fbpost_content(&$a) {
|
||||||
function fbpost_plugin_settings(&$a,&$b) {
|
function fbpost_plugin_settings(&$a,&$b) {
|
||||||
|
|
||||||
$b .= '<div class="settings-block">';
|
$b .= '<div class="settings-block">';
|
||||||
$b .= '<h3>' . t('Facebook Post Settings') . '</h3>';
|
//$b .= '<h3>' . t('Facebook Post Settings') . '</h3>';
|
||||||
$b .= '<a href="fbpost">' . t('Facebook Post Settings') . '</a><br />';
|
$b .= '<a href="fbpost"><h3>' . t('Facebook Post Settings') . '</a></h3>';
|
||||||
$b .= '</div>';
|
$b .= '</div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -765,6 +765,10 @@ function fbpost_post_hook(&$a,&$b) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(! $likes) {
|
if(! $likes) {
|
||||||
|
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
|
||||||
|
if (count($r))
|
||||||
|
$a->contact = $r[0]["id"];
|
||||||
|
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
|
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
|
||||||
|
@ -867,14 +871,17 @@ function fbpost_queue_hook(&$a,&$b) {
|
||||||
if($x['network'] !== NETWORK_FACEBOOK)
|
if($x['network'] !== NETWORK_FACEBOOK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
logger('facebook_queue: run');
|
logger('fbpost_queue_hook: run');
|
||||||
|
|
||||||
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
|
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
|
||||||
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||||
intval($x['cid'])
|
intval($x['cid'])
|
||||||
);
|
);
|
||||||
if(! count($r))
|
if(! count($r)) {
|
||||||
|
logger('fbpost_queue_hook: no user found for entry '.print_r($x, true));
|
||||||
|
update_queue_time($x['id']);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$user = $r[0];
|
$user = $r[0];
|
||||||
|
|
||||||
|
@ -908,7 +915,13 @@ function fbpost_queue_hook(&$a,&$b) {
|
||||||
logger('fbpost_queue_hook: failed: ' . $j);
|
logger('fbpost_queue_hook: failed: ' . $j);
|
||||||
update_queue_time($x['id']);
|
update_queue_time($x['id']);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger('fbpost_queue_hook: No fb_post or fb_token.');
|
||||||
|
update_queue_time($x['id']);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger('fbpost_queue_hook: No appid or secret.');
|
||||||
|
update_queue_time($x['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue