limit; //if no number has been set, default to 5 if($limit < 1){ $limit = 5; } // the page owner $options = array( 'type' => 'object', 'subtype'=>'poll', 'limit' => $limit, ); switch($widget->context){ case "groups": $options["container_guid"] = $widget->getOwnerGUID(); break; case "index": if($user_guid = elgg_get_logged_in_user_guid()){ $options["wheres"] = array("(e.owner_guid <> " . $user_guid . ")"); } break; default: $options["wheres"] = array("(e.owner_guid <> " . $widget->getOwnerGUID() . ")"); break; } if ($polls = elgg_get_entities($options)){ foreach($polls as $poll) { echo elgg_view("polls/widget", array('entity' => $poll)); } } else { echo "
" . elgg_echo("polls:widget:nonefound") . "
"; }