Permalink
Browse files

Don't show Tweet this menu items if the Twitter consumer key and secr…

…et are not sent.
  • Loading branch information...
1 parent 815cbd4 commit 31b9f57a090af3df51b46b0c0d5e02a8766d09f7 @ckieffer ckieffer committed Feb 13, 2011
Showing with 16 additions and 13 deletions.
  1. +16 −13 3.1/modules/twitter/helpers/twitter_event.php
@@ -29,22 +29,25 @@ static function admin_menu($menu, $theme) {
static function site_menu($menu, $theme) {
$item = $theme->item();
-
- $menu->get("options_menu")
- ->append(Menu::factory("dialog")
- ->id("twitter")
- ->label(t("Share on Twitter"))
- ->css_id("g-twitter-link")
- ->url(url::site("twitter/dialog/{$item->id}")));
+ if (twitter::is_registered()) {
+ $menu->get("options_menu")
+ ->append(Menu::factory("dialog")
+ ->id("twitter")
+ ->label(t("Share on Twitter"))
+ ->css_id("g-twitter-link")
+ ->url(url::site("twitter/dialog/{$item->id}")));
+ }
}
static function context_menu($menu, $theme, $item) {
- $menu->get("options_menu")
- ->append(Menu::factory("dialog")
- ->id("twitter")
- ->label(t("Share on Twitter"))
- ->css_class("ui-icon-link g-twitter-share")
- ->url(url::site("twitter/dialog/{$item->id}")));
+ if (twitter::is_registered()) {
+ $menu->get("options_menu")
+ ->append(Menu::factory("dialog")
+ ->id("twitter")
+ ->label(t("Share on Twitter"))
+ ->css_class("ui-icon-link g-twitter-share")
+ ->url(url::site("twitter/dialog/{$item->id}")));
+ }
}
}

0 comments on commit 31b9f57

Please sign in to comment.