aboutsummaryrefslogtreecommitdiff
path: root/mod/twitter_api/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/twitter_api/views/default')
-rw-r--r--mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php61
-rw-r--r--mod/twitter_api/views/default/usersettings/twitter_api/edit.php21
2 files changed, 75 insertions, 7 deletions
diff --git a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
new file mode 100644
index 000000000..fdeafd46d
--- /dev/null
+++ b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Make the user set up some alternative ways to login.
+ */
+
+$user = elgg_get_logged_in_user_entity();
+
+if (elgg_is_sticky_form('twitter_api_interstitial')) {
+ extract(elgg_get_sticky_values('twitter_api_interstitial'));
+ elgg_clear_sticky_form('twitter_api_interstitial');
+}
+
+if (!isset($display_name)) {
+ $display_name = $user->name;
+}
+
+// username
+$title = elgg_echo('username');
+
+$body = elgg_echo('twitter_api:interstitial:username');
+$body .= elgg_view('input/text', array('value' => $user->username, 'disabled' => 'disabled'));
+
+echo elgg_view_module('info', $title, $body);
+
+// display name
+$title = elgg_echo('name');
+
+$body = elgg_echo('twitter_api:interstitial:name');
+$body .= elgg_view('input/text', array('name' => 'display_name', 'value' => $display_name));
+
+echo elgg_view_module('info', $title, $body);
+
+// email
+$title = elgg_echo('email');
+
+$body = elgg_echo('twitter_api:interstitial:email');
+$body .= elgg_view('input/email', array('name' => 'email', 'value' => $email));
+
+echo elgg_view_module('info', $title, $body);
+
+// password
+$title = elgg_echo('password');
+
+$body = elgg_echo('twitter_api:interstitial:password');
+$body .= elgg_view('input/password', array('name' => 'password_1'));
+$body .= elgg_echo('twitter_api:interstitial:password2');
+$body .= elgg_view('input/password', array('name' => 'password_2'));
+
+echo elgg_view_module('info', $title, $body);
+
+// buttons
+
+echo elgg_view('input/submit', array(
+ 'text' => elgg_echo('save')
+));
+
+echo elgg_view('output/url', array(
+ 'class' => 'right',
+ 'text' => elgg_echo('twitter_api:interstitial:no_thanks'),
+ 'href' => '/',
+)); \ No newline at end of file
diff --git a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php b/mod/twitter_api/views/default/usersettings/twitter_api/edit.php
index 0898087ca..acb8d9af5 100644
--- a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php
+++ b/mod/twitter_api/views/default/usersettings/twitter_api/edit.php
@@ -3,10 +3,11 @@
* User settings for Twitter API
*/
-$user_id = elgg_get_logged_in_user_guid();
-$twitter_name = get_plugin_usersetting('twitter_name', $user_id, 'twitter_api');
-$access_key = get_plugin_usersetting('access_key', $user_id, 'twitter_api');
-$access_secret = get_plugin_usersetting('access_secret', $user_id, 'twitter_api');
+$user = elgg_get_logged_in_user_entity();
+$user_guid = $user->getGUID();
+$twitter_name = get_plugin_usersetting('twitter_name', $user_guid, 'twitter_api');
+$access_key = get_plugin_usersetting('access_key', $user_guid, 'twitter_api');
+$access_secret = get_plugin_usersetting('access_secret', $user_guid, 'twitter_api');
$site_name = elgg_get_site_entity()->name;
echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>';
@@ -16,7 +17,13 @@ if (!$access_key || !$access_secret) {
$request_link = twitter_api_get_authorize_url(null, false);
echo '<div>' . elgg_echo('twitter_api:usersettings:request', array($request_link, $site_name)) . '</div>';
} else {
- $url = elgg_get_site_url() . "twitter_api/revoke";
- echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>';
- echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>';
+ // if this user logged in through twitter and never set up an email address, don't
+ // let them disassociate their account.
+ if ($user->email) {
+ $url = elgg_get_site_url() . "twitter_api/revoke";
+ echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>';
+ echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>';
+ } else {
+ echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial')));
+ }
}