From 5b0b6f28dd224861e216c1a9279a9115b5a5b87a Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 19 Apr 2013 22:17:01 -0400 Subject: Fixes #5382 admins can turn off posting to twitter --- mod/twitter_api/languages/en.php | 2 ++ mod/twitter_api/start.php | 6 ++++-- .../views/default/plugins/twitter_api/settings.php | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mod/twitter_api/languages/en.php b/mod/twitter_api/languages/en.php index c19a058aa..a6f4b40a5 100644 --- a/mod/twitter_api/languages/en.php +++ b/mod/twitter_api/languages/en.php @@ -25,6 +25,8 @@ $english = array( 'twitter_api:revoke:success' => 'Twitter access has been revoked.', + 'twitter_api:post_to_twitter' => "Send users' wire posts to Twitter?", + 'twitter_api:login' => 'Allow users to sign in with Twitter?', 'twitter_api:new_users' => 'Allow new users to sign up using their Twitter account even if user registration is disabled?', 'twitter_api:login:success' => 'You have been logged in.', diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php index e3e866c1f..7318ac55d 100644 --- a/mod/twitter_api/start.php +++ b/mod/twitter_api/start.php @@ -35,8 +35,10 @@ function twitter_api_init() { // register Walled Garden public pages elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'twitter_api_public_pages'); - // push status messages to twitter - elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet'); + // push wire post messages to twitter + if (elgg_get_plugin_setting('wire_posts', 'twitter_api') == 'yes') { + elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet'); + } $actions = dirname(__FILE__) . '/actions/twitter_api'; elgg_register_action('twitter_api/interstitial_settings', "$actions/interstitial_settings.php", 'logged_in'); diff --git a/mod/twitter_api/views/default/plugins/twitter_api/settings.php b/mod/twitter_api/views/default/plugins/twitter_api/settings.php index 0b9afd4cf..3a3ec93a2 100644 --- a/mod/twitter_api/views/default/plugins/twitter_api/settings.php +++ b/mod/twitter_api/views/default/plugins/twitter_api/settings.php @@ -39,12 +39,27 @@ $new_users_with_twitter_view = elgg_view('input/dropdown', array( 'value' => $vars['entity']->new_users ? $vars['entity']->new_users : 'no', )); +$post_to_twitter = ''; +if (elgg_is_active_plugin('thewire')) { + $post_to_twitter_string = elgg_echo('twitter_api:post_to_twitter'); + $post_to_twitter_view = elgg_view('input/dropdown', array( + 'name' => 'params[wire_posts]', + 'options_values' => array( + 'yes' => elgg_echo('option:yes'), + 'no' => elgg_echo('option:no'), + ), + 'value' => $vars['entity']->wire_posts ? $vars['entity']->wire_posts : 'no', + )); + $post_to_twitter = "
$post_to_twitter_string $post_to_twitter_view
"; +} + $settings = <<<__HTML

$instructions


$consumer_key_view

$consumer_secret_view
$sign_on_with_twitter_string $sign_on_with_twitter_view
$new_users_with_twitter $new_users_with_twitter_view
+$post_to_twitter __HTML; echo $settings; -- cgit v1.2.3