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()) { $ads = list_entities_from_metadata_and_subtypes(array('approved'=>'0'), 'object', array('job_offering', 'job_wanted_ad', 'course'), '', $display_count, 0, true, true, 'e.time_created asc'); if ($ads) { echo $ads; } else { /*translation:No advertisements found for moderate.*/ echo elgg_echo("koolielu:error_no_advertisements_found"); } } else { /*translation:This widget works only for moderators*/ echo elgg_echo("koolielu:widget_for_mods"); } ?>