owner_guid; $owner = get_user($owner_guid); $display_count = 5; global $CONFIG; // make sure is this admin widget $admins = get_entities_from_metadata('admin', '', 'user'); if (in_array($owner, $admins)) $is_admin = true; // check that widget owner and viewer has at least moderator role if (($owner->roles == "moderator" || $owner->roles == "editor" || $is_admin) && isModerator()) { $nws = list_entities_from_metadata('approved', '0', 'object', 'news', 0, $display_count, false, false, true); if ($nws) { echo $nws; } else { /*translation:No news found for moderate.*/ echo elgg_echo("koolielu:error_no_news_found_for_moderate"); } } else { /*translation:This widget works only for moderators*/ echo elgg_echo("koolielu:widget_for_mods"); } ?>