From 065c1ac1e94b0faacb441821103a617890a8c2f9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 3 Mar 2013 16:28:06 +0100 Subject: [PATCH] gpluspost: New option for loop prevention --- gpluspost/gpluspost.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php index 586e4254..7c69f2c6 100644 --- a/gpluspost/gpluspost.php +++ b/gpluspost/gpluspost.php @@ -43,13 +43,14 @@ function gpluspost_settings(&$a,&$s) { return; $enabled = get_pconfig(local_user(),'gpluspost','post'); - $checked = (($enabled) ? ' checked="checked" ' : ''); $def_enabled = get_pconfig(local_user(),'gpluspost','post_by_default'); - $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); + $noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention'); + $noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : ''); + $s .= '
'; $s .= '

' . t('Google+ Post Settings') . '

'; $s .= '
'; @@ -62,11 +63,15 @@ function gpluspost_settings(&$a,&$s) { $s .= ''; $s .= '
'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + /* provide a submit button */ $s .= '
'; $s .= 'Register an account at Hootsuite, add your G+ page and add the feed-url there.
'; - //$s .= 'Feed-url: '.$a->get_baseurl().'/gpluspost/'.$a->user["uid"].'
'; $s .= 'Feed-url: '.$a->get_baseurl().'/gpluspost/'.urlencode($a->user["nickname"]).''; } @@ -75,6 +80,7 @@ function gpluspost_settings_post(&$a,&$b) { if(x($_POST,'gpluspost-submit')) { set_pconfig(local_user(),'gpluspost','post',intval($_POST['gpluspost'])); set_pconfig(local_user(),'gpluspost','post_by_default',intval($_POST['gpluspost_bydefault'])); + set_pconfig(local_user(),'gpluspost','no_loop_prevention',intval($_POST['gpluspost_noloopprevention'])); } } @@ -119,8 +125,8 @@ function gpluspost_send(&$a,&$b) { return; // if post comes from Google+ don't send it back - //if($b['app'] == "Google+") - // return; + if (!get_pconfig($b["uid"],'gpluspost','no_loop_prevention') and ($b['app'] == "Google+")) + return; $itemlist = get_pconfig($b["uid"],'gpluspost','itemlist'); $items = explode(",", $itemlist); -- 2.39.5