Add check to see if current user is the owner before displaying shorten link menu item.
This commit is contained in:
parent
38f1d0c4b7
commit
4c047fee13
@ -27,17 +27,19 @@ class bitly_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function site_menu($menu, $theme) {
|
static function site_menu($menu, $theme) {
|
||||||
$item = $theme->item();
|
if ($theme->item->owner->id == identity::active_user()->id) {
|
||||||
$menu->get("options_menu")
|
$menu->get("options_menu")
|
||||||
->append(Menu::factory("link")
|
->append(Menu::factory("link")
|
||||||
->id("bitly")
|
->id("bitly")
|
||||||
->label(t("Shorten link with bit.ly"))
|
->label(t("Shorten link with bit.ly"))
|
||||||
->url(url::site("bitly/shorten/$item->id?csrf=$theme->csrf"))
|
->url(url::site("bitly/shorten/{$theme->item->id}?csrf=$theme->csrf"))
|
||||||
->css_id("g-bitly-link")
|
->css_id("g-bitly-link")
|
||||||
->css_class("g-bitly-shorten ui-icon-link"));
|
->css_class("g-bitly-shorten ui-icon-link"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static function context_menu($menu, $theme, $item) {
|
static function context_menu($menu, $theme, $item) {
|
||||||
|
if ($theme->item->owner->id == identity::active_user()->id) {
|
||||||
$menu->get("options_menu")
|
$menu->get("options_menu")
|
||||||
->append(Menu::factory("link")
|
->append(Menu::factory("link")
|
||||||
->id("bitly")
|
->id("bitly")
|
||||||
@ -45,4 +47,5 @@ class bitly_event_Core {
|
|||||||
->url(url::site("bitly/shorten/$item->id?csrf=$theme->csrf"))
|
->url(url::site("bitly/shorten/$item->id?csrf=$theme->csrf"))
|
||||||
->css_class("g-bitly-shorten ui-icon-link"));
|
->css_class("g-bitly-shorten ui-icon-link"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user