Permalink
Browse files

fix(blog): correctly check if owner is a group in owner_block menu

fixes #9972
  • Loading branch information...
jdalsem committed Oct 11, 2016
1 parent be3415d commit 7f253c5861d1e34a9d170c435dbc701941115c65
Showing with 9 additions and 9 deletions.
  1. +9 −9 mod/blog/start.php
View
@@ -178,15 +178,15 @@ function blog_set_url($hook, $type, $url, $params) {
* Add a menu item to an ownerblock
*/
function blog_owner_block_menu($hook, $type, $return, $params) {
- if (elgg_instanceof($params['entity'], 'user')) {
- $url = "blog/owner/{$params['entity']->username}";
- $item = new ElggMenuItem('blog', elgg_echo('blog'), $url);
- $return[] = $item;
- } else {
- if ($params['entity']->blog_enable != "no") {
- $url = "blog/group/{$params['entity']->guid}/all";
- $item = new ElggMenuItem('blog', elgg_echo('blog:group'), $url);
- $return[] = $item;
+ $entity = elgg_extract('entity', $params);
+ if ($entity instanceof ElggUser) {
+ $url = "blog/owner/{$entity->username}";
+ $return[] = new ElggMenuItem('blog', elgg_echo('blog'), $url);
+
+ } elseif ($entity instanceof ElggGroup) {
+ if ($entity->blog_enable != "no") {
+ $url = "blog/group/{$entity->guid}/all";
+ $return[] = new ElggMenuItem('blog', elgg_echo('blog:group'), $url);
}
}

0 comments on commit 7f253c5

Please sign in to comment.