diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 839c42b3..3d28a969 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -152,6 +152,12 @@ function fbpost_post(&$a) { set_pconfig($uid,'facebook','post_to_page', $values[0]); set_pconfig($uid,'facebook','page_access_token', $values[1]); + $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`"); + if (count($result) > 0) { + set_pconfig(local_user(),'fbsync','sync',intval($_POST['fbsync'])); + set_pconfig(local_user(),'fbsync','create_user',intval($_POST['create_user'])); + } + info( t('Settings updated.') . EOL); } @@ -207,7 +213,15 @@ function fbpost_content(&$a) { $a->page['htmlhead'] .= '' . "\r\n"; - $o .= '

' . t('Facebook Export/Mirror') . '

'; + $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`"); + $fbsync = (count($result) > 0); + + if($fbsync) + $title = t('Facebook Import/Export/Mirror'); + else + $title = t('Facebook Export/Mirror'); + + $o .= '

'.$title.'

'; if(! $fb_installed) { $o .= '
'; @@ -279,8 +293,20 @@ function fbpost_content(&$a) { $o .= ""; - $o .= '

'; + if ($fbsync) { + $o .= '
'; + + $sync_enabled = get_pconfig(local_user(),'fbsync','sync'); + $checked = (($sync_enabled) ? ' checked="checked" ' : ''); + $o .= '' . ' ' . t('Import Facebook newsfeed.') . EOL; + + $create_user = get_pconfig(local_user(),'fbsync','create_user'); + $checked = (($create_user) ? ' checked="checked" ' : ''); + $o .= '' . ' ' . t('Automatically create contacts.') . EOL; + + } + $o .= '

'; } return $o; @@ -291,11 +317,15 @@ function fbpost_content(&$a) { * @param null|object $b */ function fbpost_plugin_settings(&$a,&$b) { + $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`"); + if(count($result) > 0) + $title = t('Facebook Import/Export/Mirror'); + else + $title = t('Facebook Export/Mirror'); $b .= '

'; - $b .= '

' . t('Facebook Export/Mirror') . '

'; + $b .= '

'.$title.'

'; $b .= '
'; - } diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index f6310ccf..a1f88af9 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -100,6 +100,9 @@ function fbsync_follow($a, &$contact) { function fbsync_settings(&$a,&$s) { + // Settings are done inside the fbpost addon + return; + if(! local_user()) return; @@ -120,11 +123,11 @@ function fbsync_settings(&$a,&$s) { /* Add some HTML to the existing form */ $s .= ''; - $s .= '

' . t('Facebook Import') . '

'; + $s .= '

'. t('Facebook Import').'

'; $s .= '
'; $s .= '